Menu

Some ES2015 scratches

13th April 2018 - Uncategorised

Just popping it here as a bookmark


const d=document;
const t=(txt)=>d.createTextNode(txt);
const cr=(d,el)=>d.createElement(el);
const ap=(el,ch)=>el.appendChild(ch);
const de=(el)=>d.getElementById(el);
const br=()=>cr(d,"BR")
const na=new Array(100).fill(0);
const rc=()=>Math.random()>0.5?"/":"\\";


window.onload=function(){
const el=de("amazing")
na.map(r=>{ap(el,br());na.map(c=>{ap(el,t(rc));})})


for(let r in na){
ap(el,br());
for(let c in na){
ap(el,t(rc));
}
}


na.map(r=>{
document.write("
");
na.map(c=>{
document.write((Math.random()>0.5?"/":"\\"));
})
})
}