JS cheat sheet
programming-idioms.org · 9,991 words · saved by 1 readers
The snippets are under the CC-BY-SA license. Creative Commons Attribution-ShareAlike 3.0
JS 1 Print Hello World Print a literal string on standard output document.write("Hello World!"); Demo Doc Alternative implementation: console.log('Hello World'); Demo Doc Alternative implementation: console.log('Hello World') Doc 2 Print Hello 10 times Loop to execute some code a constant number of times for (let i = 0; i < 10; i++) { console.log("Hello"); } Demo Doc Alternative implementation: let count = 0; while (count < 10) { count++; console.log('Hello'); }; Alternative implementation: [...Array(10)].forEach(() => console.log('Hello')) Demo Alternative…
saved by
related reading
- JavaScript Articles - 30 seconds of code30secondsofcode.org
- Code Snippets • Josh W. Comeaujoshwcomeau.com
- Chloe's Gardenchloeyan.me
- GitHub - Experience-Monks/math-as-code: a cheat-sheet for mathematical notation in code formgithub.com
- Everything is Fertilenickcammarata.com
- Intrinsic Values Test | Discover What Your Most Important Values Are | ClearerThinking.orgprograms.clearerthinking.org
- JavaScript Articles - 30 seconds of code30secondsofcode.org
- CoffeeScriptcoffeescript.org
- Documentationdocs.swift.org
- Program Structure :: Eloquent JavaScripteloquentjavascript.net
- ///_hyperscripthyperscript.org
- Automate the Simple Stuff With Stupid Toolsevery.to