Skip to content

Commit 4966678

Browse files
committed
added example for spread
1 parent 97d2b42 commit 4966678

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

let.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* let desclares a block scope local variable. let has been in Firefox for a
2+
* let declares a block scope local variable. let has been in Firefox for a
33
* long time and is now a part of ES6.
44
* IMPORTANT: If outside any block, let is scoped globally else will be scoped
55
* to nearest enclosing block.

spread.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* spread allows you to pass each element of an array as a parameter.
3+
*/
4+
5+
var list = [1, 2, 3, 4];
6+
7+
function foo(i, j, k, l){
8+
return i*j*k*l;
9+
}
10+
11+
foo(...list); // 24

0 commit comments

Comments
 (0)