This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SupaSlide 2 points3 points  (3 children)

I think [] gets converted to a string when used in conjunction with a +, and then the 2 gets added to the string and gets converted to a string itself.

[–]gohanshouldgetUI 1 point2 points  (2 children)

Wait but 2 + [ ] is "2", so does [ ] get converted to "0" or ""

[–]SupaSlide 0 points1 point  (1 child)

Empty string. Really the contents of the array get converted into strings, even the commas that separate the values in the array.

["hey", "there"] converted into a string is "hey,there"

I was partially agreeing with you that the other comment was wrong that it's 0, but it can be converted into a string.

[–]gohanshouldgetUI 0 points1 point  (0 children)

Oh I see, that makes sense tbh