New Array Methods

Static methods

Array.of
Array.from

Array.of

var arr = Array(4); // arr.length = 4
var arr1 = Array.of(4); // arr1.length = 1 

// create array from the passed arguments
console.log(Array.of(2,3,4,5)); // [2,3,4,5]

Array.from

want to use Array methods on arguments

// ES5
function greetMe(){
    console.log(arguments.join('--')); // TypeError: arguments.join is not a function
}

console.log(greetMe('hemant', "hello"));

Array.from use case 1

Array.from use case 2

Array instance methods

[].find

[].findIndex()

[].copyWithin()

Last updated

Was this helpful?