Yes if you're calling it on a String. "The split() method splits a String object into an array of strings by separating the string into substrings."
To be precise, .split() is a String method, so it works on String objects. As stated, it converts the string into an array of strings separated by the separator value passed to .split(). If an empty string is passed as the separator value, an array of characters comprising the original string is returned.
See also: "Note: When the string is empty, split returns an array containing one empty string, rather than an empty array."
The answers claiming you cannot call it on non-String objects are correct. Calling it on a non-String object results in Uncaught TypeError: undefined is not a function.
For example:
var name = "234";
var newName = name.split("3");
console.log(newName);
This returns ["2","4"]
var name = 234;
var newName = name.split("3");
console.log(newName);
Returns the TypeError above.
If you insist on using .split() on a non-String object, you can call it using .call() to access the .split() method via prototypal inheritance as follows.
var name = 234;
var newName = String.prototype.split.call(name, "3");
console.log(newName);
This prints ["2","4"] to the console.
checkis returned, only the last value in yourforloop will be returned.checkgets assigned the result ofsen.split(), so it becomes an array when you do that.check = 3; check = []; check = new Date();, and each assignment will replace the old value, ignoring the old value's type entirely.