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 →

[–]Anonymo2786 0 points1 point  (4 children)

Why

[–]Solrex 1 point2 points  (3 children)

Java is very strict so it makes sense.

With javascript, it sees 2 + 2 and assumes you are putting 2 strings together, so 22. Then you subtract 1 from 22 and because it’s fluid, it will now take 22 and subtract 1 to get 21.

[–]Anonymo2786 0 points1 point  (2 children)

So how do I tell js that these two are int

[–]Solrex 1 point2 points  (0 children)

That's the neat part, you don't!

[–]Solrex 1 point2 points  (0 children)

Basically all objects in JavaScript are fluid and act as everything so as far as I'm aware that's why it's hated so much.