...

/

Solution Review: Array or Not?

Solution Review: Array or Not?

This lesson will explain the solution to the problem in the previous lesson.

Solution #

Press + to interact
function check(obj) {
if (Object.prototype.toString.call(obj) === "[object Array]") {
return true;
} else {
return false;
}
}
console.log(check(123));
console.log(check("cat"));
console.log(check([1, 2, 3, 4]));
...
Access this course and 1400+ top-rated courses and projects.