Answers for "javascript codegolf"

0

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...
Posted by: Guest on June-02-2020
0

javascript codegolf round

var n = 53.73;
var rounded = n|0; //53
Posted by: Guest on June-02-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language