simple string split is returning object instead array

The output of String.prototype.split is an Array and that is an Object.

console.log(typeof []);
// object

You can confirm that the returned object is an array, like this

console.log(Object.prototype.toString.call(arr));
// [object Array]
console.log(arr);
// [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k' ]

Quoting from the MDN Documentation of String.prototype.split,

The split() method splits a String object into an array of strings by separating the string into substrings.


Arrays are objects in javascript.

If you want to check if its an array -

you can do -

Array.isArray(arr)