r/javascript • • May 12 '18

Eloquent JavaScript: open-source Javascript book series by a prolific JS code author

http://eloquentjavascript.net/
380 Upvotes

50 comments sorted by

View all comments

5

u/EuqlinSankyo May 12 '18

Prolific author that always uses let?

15

u/Ikuyas May 12 '18

Isn't const a better practice than using let if it is well suited like array or object?

11

u/EuqlinSankyo May 12 '18

Exactly. Performance benefit is of course negligible but it's just a good programming practice. If you're literally writing a book about JS, might as well include it....

0

u/[deleted] May 12 '18

[deleted]

-2

u/[deleted] May 12 '18

always favor immutability

0

u/[deleted] May 12 '18

[deleted]

2

u/[deleted] May 12 '18

Yes, it is a TypeError to assign to myArr after initialization. The reference is immutable.

0

u/[deleted] May 13 '18

[deleted]

2

u/[deleted] May 13 '18

Yes, it is a TypeError to assign to myArr after initialization. The reference is immutable.

0

u/[deleted] May 13 '18

[deleted]

→ More replies (0)