console.log('%c Hi everyone!', 'color: #1c87c9; font-size: 18px');
console.log('%c Style 1! %c Style 2!',
'color: #1c87c9; background: #ccc; font-size: 20px;',
'color: #8ebf42; background: # 666; font - size: 20 px;'
);
let number = 4579
let hexStr = number.toString(16)
console.log(hexStr) // 11e3
let hexStr2 = '11e3'
let number2 = parseInt(hexStr2, 16)
console.log(number2) // 4579
let str = "Hello People"
let encodedString = btoa(str)
console.log(encodedString) // "SGVsbG8gUGVvcGxl"
let dec = atob(encodedString)
console.log(dec) // "Hello People"
canvas.toBlob(function(blob) {
// blob ready, download it
let link = document.createElement('a');
link.download = 'example';
link.href = URL.createObjectURL(blob);
link.click();
// delete the internal blob reference, to let the browser clear memory from it
URL.revokeObjectURL(link.href);
}, 'image/jpg');
<a download="hello.txt" href='#' id="link">Download</a>
<script>
let blob = new Blob(["Hello, world!"], {type: 'text/plain'});
link.href = URL.createObjectURL(blob);
</script>
hljs.highlightAll() 函数