Hey ! Welcome here ! At the end of this article you will improve your javascript skills thanks to know the difference between a lot of concept that...
For further actions, you may consider blocking this person and/or reporting abuse
The point about Spread and Rest is not correct, it should be the other way around.
Source: MDN
Nice explication thank for sharing Khang!
Hello, these are some interesting comparisons.
I was kinda surprised to see no example of
spread
in the 'Spread vs rest' section. A few examples ofspread
:I was also surprised to see no example of
function
in the 'Hoisting' section. It is the one form of hoisting that I find very useful because it allows you to optimize the readability of the code.An example that hopefully communicates how you can improve readability by relying on hoisting:
This helps the reader by obtaining an overview before diving into details.
Nice thank you!
When to use
var
? Don't.Use it if you need to declare a variable globally and modify it in a function and the changed value to be available globally. Probably best to leave comments as well as this would be unusual behaviour. There are likely other ways to achieve your logic as well
Yes and moreover, it can be dangerous to create global variable in general since you can easily override it
Sort of. You should declare it globally BECAUSE you intend to modify it within a localised scope. This is how the js frameworks work. Vue is effectively a Global object which can have it's properties manipulated by the functions within it. but then we are getting into immutability and state management.
Thanks for this
A nice article as always, thoses basics concept should be used and known by all !