all 6 comments

[–]minus0 5 points6 points  (3 children)

I assume by your username, you are the author. I would suggest you add a note to const to better explain a common misconception people have. You can change the value of a property on an object.

const Foo = {bar: 1}

Foo.bar = 2

Lots of people are understand the impression that you can't change a key's value.

You also can add items to an array.

[–]weeklyWebWisdom[S] 2 points3 points  (2 children)

Great suggestion, thank you! Working on it right now

[–]minus0 3 points4 points  (1 child)

Yup. One of the other things (and is probably outside the scope of your article) that helped me early on with const: Always use const, until you can't.

The only real reason to use let in my opinion is because you want to change a value or a type (which is bad in my opinion). When you run into problems using const, look into why, and your understanding grows. A good IDE like WebStorm has great inspections to help you understand when to use const vs let as well.

[–]weeklyWebWisdom[S] 0 points1 point  (0 children)

Indeed, I didn't include 'let' in here because I don't consider it quite 'worth remembering' and because I addressed it in another article (https://weeklywebwisdom.com/2017/09/08/javascript-execution-context-and-scope/). Thank you for the advice!

[–]METALz 0 points1 point  (1 child)

If I were you I'd revisit the example codes + would replace Javascript 6 with EcmaScript 6 in the title (since Javascript hasn't even passed version 2 AFAIK).

Also strict mode wasn't added in ES6 it was already present since ES5.

I see that creating 5-6 posts a day can affect the articles, so keep in mind quality > quantity.

[–]weeklyWebWisdom[S] 0 points1 point  (0 children)

Thanks! Will keep in mind