+ 1
I got a question on challenge like var a="I like studying with Sololearn", var b =a.split(" "), document.write(b)
the answer was given based on assuming var a is an array .The answer was I,like, studying,with,Sololearn. Shouldn't be the answer is undefined.
2 ответов
+ 2
The answer given was correct :
'var a' is a string
The result returned (in b) by the split method is an array, where the items are each substring from 'a' surrounded by spaces.
Then 'document.write(b)' displays all array elements separated by a comma.
+ 1
Okay I got it.