HomeОбразованиеRelated VideosMore From: thenewboston

ECMAScript 6 / ES6 New Features - Tutorial 4 - Spread Operator

320 ratings | 25517 views
Facebook - https://www.facebook.com/TheNewBoston-464114846956315/ GitHub - https://github.com/buckyroberts Google+ - https://plus.google.com/+BuckyRoberts LinkedIn - https://www.linkedin.com/in/buckyroberts reddit - https://www.reddit.com/r/thenewboston/ Support - https://www.patreon.com/thenewboston thenewboston - https://thenewboston.com/ Twitter - https://twitter.com/bucky_roberts
Html code for embedding videos on your blog
Text Comments (24)
Bharath kumar Kande (1 month ago)
Very informational and helpful. Can you please avoid keyboard tap sounds in further videos, it is really disturbing.
Stephen Chmielinski (1 month ago)
Example 1 (function pulling arguments from an array) 1:17 Completed traditional code 1:42-2:06 (ES6) Example 2 (insert all the elements of one array into another, at any index) 3:35-4:09 (ES6)
David Donadze (2 months ago)
thank u
ssains (2 months ago)
i miss you bucky
ChetBABY z (4 months ago)
oh noooooo! another 'clacky keyboard vid'!
Sairaj Das (5 months ago)
var args
Yash Arora (8 months ago)
awesome !!!!!!
Hans (8 months ago)
thanks
prashanth kumar (8 months ago)
you are good
Christian Rodier (8 months ago)
That is way amazing!
Tomáš Štrigner (1 year ago)
1st example is not a good one. It was possible to spread array as arguments to function/method before. And as a bonus, it was possible to calling it under specific scope via funct.apply(scope, [argsArray]) like: function addNumbers(a, b, c) {    console.log(a + b +c); } var nums = [3, 5, 7]; addNumbers.apply({},nums);
priya harish (1 year ago)
I learnt PHP from you. Had been procrastinating learning es6.. BUT not anymore!! lots of love Bucky!! <3 #rolemodel
Lucas Shanley (1 year ago)
Bucky I freaking love your vids!!! This solves the problem I have been having recently! Thanks yet again for the many years of great content :-)
Martin Soušek (1 year ago)
Now what if number of parameters of the function does not match the array length?
info sEc (4 months ago)
in this case , JS will return NaN - see below example : function addNum(a,b,c) { console.log(a+b+c); } var arr = [1,2]; addNum (...arr); // JS will return NaN - the function is declared with 3 parameters while array has only 2 elements passed to the function by Spread Operator. it will evaluate like this : (1+2+undefined) --> // NaN
candh (2 years ago)
what the fuck
Rashad Kokash (2 years ago)
Could you please make the font bigger in future videos :D
tarun nagpal (7 months ago)
+1
Dankest Elf (2 years ago)
what about the apply function?
Abeltensor (2 years ago)
annoying I can't get the spread operator to work in webstorm. I'm using es6 and have the babel watcher running but it keeps throwing an error, any tips Bucky?
Ex Legend (2 years ago)
syntax is too cryptic, not a fan....
〈FireMan/〉 (2 years ago)
just food for thought eval(array.join("+")) var meats = ["bacon","ham"] var food = ["apples", meats, "Kiwi","rice"]
〈FireMan/〉 (2 years ago)
they are all ways of doing what he does in the video with vanilla javascript
LJ (2 years ago)
what?

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.