javascript
Installation
SKILL.md
JavaScript
Modern JS is expressive and fast — most footguns come from async handling, mutation, and equality/coercion surprises. Prefer clarity and immutability; let the engine optimize.
Language baseline
constby default,letwhen reassigning, nevervar.- Use
===/!==; avoid==(coercion surprises). Know thatNaN !== NaN(useNumber.isNaN). - Prefer pure functions and immutable updates (
{...obj},[...arr],.map/.filter/.reduce) over in-place mutation of shared data. - Optional chaining
?.and nullish coalescing??(distinct from||, which also catches0/""). - Use modules (
import/export); no global leakage. Keep imports at the top. - Prefer
for...of/ array methods over index loops;Map/Setover object-as-dict for dynamic keys.