JavaScript can be weird at times

Not to mention jQuery (but that could be it’s own post).

We know of the Object.hasOwnProperty baggage and any other of the well documented flaws of JavaScript, but one I came across last night was pretty weird.

I was in the process of basically rewriting a good chunk of a function last night, and I had trimmed the number of accepted arguments while forgetting to update the call. When I found the err of my ways, I was surprised to learn an error message had not been thrown the whole time the call was flawed. I was not referencing any of the now-replaced parameters, but I still would have expected a message to be raised. I mean, when I am coding in Python, such a mistake throws an error and stops the entire program. Not here! Everything went right along, no message given, no breaks halting the process, nothing seemed to be broken (at least nothing that was not already a mess :P).

This is just one of the many quirks I have run into while programming in JavaScript, from both yesterday and since I started. Yet I push through it and keep coding. After all, all programmers must face issues if they wish to sharpen and improve their skills. In addition, this typeof challenge is what drew me to programming a year ago last month (yes, hard to believe it has been almost a year since I start programming). 🙂

I round out this post with a short (only 4 minutes), quite funny video I was introduced to. It is simply entitled wat, and humorously talks about some of the quirks of the Ruby and JavaScript programming languages. Even if you are not a Ruby or JS programmer, I recommend you watch it. The basic concepts are all the same (in terms of the operators he uses, not the flaws :P), and the stuff he shows off is… I was a minute through it and already I was laughing. 😛

The video can be seen at destroyallsoftware.com/talks/wat. I really do thing you will like it. 😀
-le717

Advertisements

Triangular Reactions

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s