Home  »  CodeGuidesProgrammingSnippetsTechnology   »   How to Check Value is Array or not in JavaScript

How to Check Value is Array or not in JavaScript

Posted: October 3, 2022 | by Michael Bright

Use this to check if value is array or not in JavaScript:

const str = "foo";
const check = Array.isArray(str);
console.log(check);

// Result: false
const arr = [1,2,3,4];
const output = Array.isArray(arr);
console.log(output);

// Result: true

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.