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...var n = 53.73;
var rounded = n|0; //53
Also in JavaScript:
- js splice 2d array
- how to add multiple styles in javascript
- Convert longest string in array
- syntax for srcset in react
- trigger play video jquery
- jquery window trigger resize
- filter
- classList has class
- validate form in reactstrap modal api
- how to set markers in d3.js map projection
- react modal
- text input phone number react native
- excel javascript api protect worksheet
- click and copy jquery dynamic content
- dataset js
- slide when mouse over gadget jquery
- codeigniter ajax crud using datatables
- switch in react
- javascript biggest number
- js canvas draw image
- find in js
- javascript is valid email
- lodash pascal case
- node.js web scraping