beautify js with source map code example
Example 1: array.unshift in javascript
const array1 = [1, 2, 3];
console.log(array1.unshift(4, 5));
console.log(array1);
Example 2: how to edit a fil with vanilla js
(function () {
var textFile = null;
function makeTextFile(text) {
var data = new Blob([text], {type: 'text/plain'});
if (textFile !== null) {
window.URL.revokeObjectURL(textFile);
}
textFile = window.URL.createObjectURL(data);
return textFile;
}
var create = document.getElementById('create');
var textbox = document.getElementById('textbox');
create.addEventListener('click', function () {
var link = document.getElementById('downloadlink');
link.setAttribute('download', 'info.txt');
link.href = makeTextFile(textbox.value);
link.style.display = 'block';
window.requestAnimationFrame(function () {
var event = new MouseEvent('click');
link.dispatchEvent(event);
document.body.removeChild(link);
});
}, false);
})();