|
|
|
|
|
by wk_end
1631 days ago
|
|
Disagree: virtually everything in JS is mutable, so this almost means "never use the `const` keyword". Pretending that the `const` keyword means something that it doesn't makes things harder for my limited human mind to understand, not easier. Plus using `let` inappropriately makes my linter yells at me, and I usually like to just do whatever my linter tells me. Anyway, I use TypeScript, so if I really want to assert that my array is immutable (as immutable as stuff in JS-land gets anyway) I just write: const input: readonly number[] = [1, 2, 3, 4, 5];
or even const input = [1, 2, 3, 4, 5] as const;
|
|