1. 基本语法
Array.of(元素0[, 元素1[, ...[, 元素N]]]
- 说明
- 参数:元素可以是任意多个
- 作用:创建一个具有可变数量参数的新数组实例,而不考虑参数的数量或类型
2. 用法实例
let a = Array.of(10);
let b = Array.of("you","hai","dong")
let c = Array.of(true,false);
let d = Array.of();
let e = Array.of(null,null,null,null);
let f = Array.of(undefined,undefined,undefined);
let g = Array.of({},{},{});
console.log(a);
console.log(b);
console.log(c);
console.log(d);
console.log(e);
console.log(f);
console.log(g);
网友评论