JavaScript Awfulness

Did you know that in JavaScript, if you do this:

'5' + 3

You will get 53.

But yet if you do this:

'5' - 3

You will get 2.

That’s what happens when you have a weakly typed language using ‘+’ for string concatentation. :)

Another oddity… In Java:

 
Integer foo = 1000;
Integer bar = 1000;
 
foo <= bar; // true
foo >= bar; // true
foo == bar; // false

I love these little language quirks. :)

Posted: December 6th, 2010 | Author: | Filed under: benlakey.com | Tags: , , | No Comments »

Leave a Reply