"... Three Dots" đã thay đổi javascript như thếnào ?
https://learnreac.gitbook.io/project/object-for-three-dots-array-for-three-dots-ok
function display(){
// arguments is an array-like object
var args = Array.apply(null, arguments);
console.log(args); // [1, 2, 3]
}
display(1, 2, 3)var fruits = ['banana'];
var moreFruits = ['apple', 'orange'];
Array.prototype.push.apply(fruits, moreFruits);
console.log(fruits); // => ['banana', 'apple', 'orange'] Three dots
The rest operator
The spread operator
Inject params to constructor
Quickly initial elements from another array
Array destructure
Finale
PreviousThree dots ( … ) in JavaScriptNextArray-like objects, Chuyển đối tượng arguments thành array (ok)
Last updated