Search posts, tags, users, and pages
Learning any modern frontend framework requires knowledge on some great features of JavaScript ES6. From my experience I thought of sharing 5 features of ES6 that I encountered using most often. So, in this post I will share simple explanation of the...
Tringa Krasniqi
@tringacodes · Prague, Czech Republic
Web developer
Markdown supported · ⌘↵ to post
ShishirB
Regarding the spread and rest operator, why does it have two names when it does the same thing in both cases? It does spread the values in both cases, right ?
Nikolai Kolesnikov
I guess it depends on point of view.
When you declare function it is "rest": function funcName(a, b, ...rest) { console.log(rest); }
When you call function (or fill array, object) and try to pass a few arguments it is "spread":
funcName(...spread); [...spread]; {...spread};
ShishirB
Regarding the spread and rest operator, why does it have two names when it does the same thing in both cases? It does spread the values in both cases, right ?