Esta palestra aborda estruturas de dados nativas do JavaScript e como podemos usá-las de forma a escrever código mais eficiente. Apresentada no CEJS em Fortelza, Ceará.
or // let map = new WeakMap(); const MAX_LOOP = 50000; function runBenchmark(){ for(let i=0; i < MAX_LOOP; i++){ let item = { number: i }; map.set( item, "item" ); } } runBenchmark();
or // let map = new WeakMap(); const MAX_LOOP = 100000; function runBenchmark(){ for(let i=0; i < MAX_LOOP; i++){ let item = { number: i }; map.set( item, "item" ); } } runBenchmark();
or // let map = new WeakMap(); const MAX_LOOP = 1000000; function runBenchmark(){ for(let i=0; i < MAX_LOOP; i++){ let item = { number: i }; map.set( item, "item" ); } } runBenchmark();
); tags.add( "Web" ); tags.add( "Programming" ); // for...of for(let tag of tags){ console.log( tag ); // JavaScript } // Web // Programming // destructuring let [a,b,c] = tags; console.log( a, b, c ); // JavaScript Web Programming
? is it here ? is it here ? guitar guitar let sg = { model: "SG" }; let lesPaul = { model: "Les Paul" }; let nighthawk = { model: "Nighthawk" }; let sold = new WeakSet(); sold.add( sg ); sold.add( lesPaul ); // checking against WeakSet if( sold.has(sg) ){ console.log( "sold" ); } if( !sold.has(nighthawk) ){ console.log( "not sold" ); } Immutable!