javascript shoten loop golf code example

Example 1: javascript codegolf

x|0 //Round x down
func`arg` //Call function with one string argument
getContext`2d`; // ^
`rgb(${r}, ${g}, ${b})` //Template literals
C //together with <canvas id=C> instead of document.getElementById("C");
1e3 //Shorter than 1000
1e-3 //Shorter than 0.001
setInterval(`console.log("something")`, 100) //Instead of function() { ... }
(a,b)=>a+b //Arrow function
_=>{} //Instead of ()=>{}
a=5 //Remove var (be careful with global vars)
innerWidth //Remove window (Instead of window.innerWidth)
99 //Sometimes 99 works instead of 100 or 9 istead of 10

//More coming soon...

Example 2: javascript codegolf round

var n = 53.73;
var rounded = n|0; //53