how to check if an array is 2d or not in javascript code example Example: js if array is 2d if (arr[0].constructor === Array) { /*...*/ }