As a developer, it's crucial to stay updated with recent technologies to remain relevant and streamline development processes. The newer the techno...
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
Pictures of code are not accessible to users that require assistive technology, it's much better to embed code directly in the post using the markup tags to syntax highlight it.
Alright, I'll take note.
Thanks for the feedback.
If you are unsure about the post editor, you will find a great explanation here. Code examples are introduced using three backticks followed by a language identifier, in this case JS or Javascript.
@gloriasilver I wouldn't bother. So few programmers use assistive technology that it's not worth the effort. They can always do the reverse image thing.
The array methods
map
,reduce
, andfilter
were introduced in ES5.Nope.
Array methods like map, reduce, and Filter were introduced in Es6.
Check for confirmation.
Definitely ES5...
w3schools.com/js/js_es5.asp
x-team.com/blog/javascript-es5-arr...
prowaretech.com/articles/current/j...!
subscription.packtpub.com/book/pro...
geeksforgeeks.org/javascript-es5-j...
jackfranklin.co.uk/blog/ecmascript...
Alright.
I have checked.
Thank you for the clarification.🤙
I'll adjust the post.
They even work in Internet Explorer 9.
"Notice the two methods perform the same function, but the arrow function provides a simpler way of declaring the function"
Important to mention is, that Arrow Functions doesnt have their own context. So when you do something like:
the console log of
y
will point at thethis
of the parent butx
would have its own contextplease be super careful with this one... spreading an array only creates a shallow copy, so presenting this as a way to "quickly copy them" is misleading and downright dangerous, especially to people who are still learning JS.
usually, I recommend that people only use the spread operator for changing data structures on-the-fly while passing arguments to a function, never for trying to make copies of existing data structures. in my mind, this is nothing but a fast track to impure functions that could create runtime issues that are ridiculously difficult to locate later on.. unit tests don't always help catch this either, especially since most unit tests will not have an environment that persists between runs.
the MDN docs do a very good job of explaining this behaviour, definitely worth taking the time to read. I'll include their sample code snippet here for easier reference:
You're missing some pretty fundamental differences with arrow functions over traditional functions that, I feel, your article would have benefitted enormously from including. Namely (and this from the first paragraph of the MDN article on arrow functions):
To my mind, the first bullet there is the most important to bear in mind since misunderstanding
this
binding is often a cause of unpredictable code.The difference between the normal traditional function and the arrow could have been provided by a more precise example like the case of "this" in the normal function and arrow function.
BTW the blog is very helpful.
super on fire, this aricle
ES6 (ES2015) came out in 2015. Currently we are using ES14 (ES 2023).
Nevertheless, an useful article as I've heard of colleges that hadn't updated their curriculum.