javascript-tips-and-tidbits
javascript-tips-and-tidbits copied to clipboard
A continuously-evolving compendium of javascript tips based on common areas of confusion or misunderstanding.
I read through the Rest Syntax section and I felt it was improvement could be made by letting readers know that you can use declared params and rest syntax together....
E.g. with ``` function* numbers(x) { yield 1; yield 2; yield 3; yield x; } ``` For..of: ``` for (const x of numbers(99)) { console.log(x); } // => 1 //...
I have a few changes I'd like to submit. The first is largely opinion based but I think the community adopting a consistent style will ease the onboarding process for...
Please consider replacing the increment/decrement operators (`++` and `--`) for their cousins, `+=` and `-=` respectively. Even there is no consensus if those operators are good/bad, there are some who...
It's not needed to convert to array in this example: `[...$$("a[href *='#']")].forEach(console.log);` `querySelectorAll` returns `NodeList`. While that is not an array, it does have `forEach` natively. It would be more...
This is an open call for any tips! Please let me know if you have anything to share. Additionally, if you're relatively new to javascript, let me know what questions...