0

Can someone help me understand toString()?

I've been having problems printing arrays and I need some help. I googled it but didn't find a satisfying explanation (more accurately, I understood almost nothing). Can anybody tell me how to use it and give me an example about it, please?

23rd Oct 2018, 12:44 AM
M. Elle
M. Elle - avatar
2 ответов
+ 2
It's pretty straight forward. It does what its name implies, transforms an object into a string. Imagine we have this: var arr = [ 0, 1, 2 ]; console.log(arr.toString()); // output: 0,1,2 give it a try, get familiar with it
23rd Oct 2018, 1:49 AM
voidneo
+ 1
noname, thank you very much!
23rd Oct 2018, 3:05 AM
M. Elle
M. Elle - avatar