Array.from()

Convert other data types to arrays

1. Basic usage

console.log(Array.from('str')) //["s","t","r"]

2. Which can be converted to arrays by array.from ()?

All traversable. Array, string, Set, Map, NodeList, arguments;

Any object that has the length attribute

3. The second parameter

Map methods that act like arrays

console.log(Array.from('12',value => value*2)) //[2, 4]

undefined

1. Both a primitive data type and a primitive value data

2. Undefined is an attribute of a global object. Window. undefined (not writable, configurable, enumerable)

3. The system automatically assigns the value of undefined to an unassigned variable

4. If the function returns no value, the system returns undefined by default

5. Undefined is not a reserved JS word or keyword