JS/Javascript
Array.isArray()
싸공
2020. 7. 10. 17:24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
let a, b, c, d, e, f;
a = Array.isArray(["one", "two", "three"]);
b = Array.isArray({arr : "1"});
c = Array.isArray('arr');
d = Array.isArray(1);
e = Array.isArray(null);
f = Array.isArray(undefined);
console.log(a);
console.log(b);
console.log(c);
console.log(d);
console.log(e);
console.log(f);
|
cs |
Array가 맞으면 true 아니면 false를 반환한다.
출력 화면
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
Array.isArray()
Array.isArray() 메서드는 인자가 Array인지 판별합니다.
developer.mozilla.org