javascript codegolf

Solutions on MaxInterview for javascript codegolf by the best coders in the world

showing results for - "javascript codegolf"
Tiphaine
19 Nov 2016
1x|0 //Round x down
2func`arg` //Call function with one string argument
3getContext`2d`; // ^
4`rgb(${r}, ${g}, ${b})` //Template literals
5C //together with <canvas id=C> instead of document.getElementById("C");
61e3 //Shorter than 1000
71e-3 //Shorter than 0.001
8setInterval(`console.log("something")`, 100) //Instead of function() { ... }
9(a,b)=>a+b //Arrow function
10_=>{} //Instead of ()=>{}
11a=5 //Remove var (be careful with global vars)
12innerWidth //Remove window (Instead of window.innerWidth)
1399 //Sometimes 99 works instead of 100 or 9 istead of 10
14
15//More coming soon...
Mira
01 Mar 2019
1var n = 53.73;
2var rounded = n|0; //53