MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/j90bx6/javascript_can_keep_you_safe/g8it4dr/?context=3
r/learnjavascript • u/weoter • Oct 11 '20
87 comments sorted by
View all comments
5
ES5
2 u/Macaframa Oct 11 '20 What features in es6 would you use to make this different in any way? 4 u/james527 Oct 11 '20 const still_alive = true;Make that one immutable. 2 u/Macaframa Oct 11 '20 Const is not immutable per se but go off. 1 u/james527 Oct 12 '20 True, it's just the reference that's immutable.If we were referencing an array here, instead of a boolean, we'd still be able to change the contents of the array. We just wouldn't be able to reassign the still_alive variable to anything else.
2
What features in es6 would you use to make this different in any way?
4 u/james527 Oct 11 '20 const still_alive = true;Make that one immutable. 2 u/Macaframa Oct 11 '20 Const is not immutable per se but go off. 1 u/james527 Oct 12 '20 True, it's just the reference that's immutable.If we were referencing an array here, instead of a boolean, we'd still be able to change the contents of the array. We just wouldn't be able to reassign the still_alive variable to anything else.
4
const still_alive = true;
Make that one immutable.
2 u/Macaframa Oct 11 '20 Const is not immutable per se but go off. 1 u/james527 Oct 12 '20 True, it's just the reference that's immutable.If we were referencing an array here, instead of a boolean, we'd still be able to change the contents of the array. We just wouldn't be able to reassign the still_alive variable to anything else.
Const is not immutable per se but go off.
1 u/james527 Oct 12 '20 True, it's just the reference that's immutable.If we were referencing an array here, instead of a boolean, we'd still be able to change the contents of the array. We just wouldn't be able to reassign the still_alive variable to anything else.
1
True, it's just the reference that's immutable.
If we were referencing an array here, instead of a boolean, we'd still be able to change the contents of the array. We just wouldn't be able to reassign the still_alive variable to anything else.
5
u/zigzeira Oct 11 '20
ES5