JSON stands for JavaScript Object Notation. You would think it would be second nature to parse those strings from your Ajax request, but not so much for older browsers. The modern browsers do have the JSON api that makes…
Read article
In modern browsers, JavaScript has a .trim() function on the String object. What it does is simple, it removes the extra white space before and after the string.
var text = " I have space before and after ";
v…
Read article
Old versions of Internet explorer do not support new html5 tags. In HTML5 the `` tag for example allows you to embed a video on your page directly into your page, without having to resort to flash. HTML5 shims do not mak…
Read article
JavaScript comparison symbol does not work in the same fashion as other languages. The double equal symbol == performs something called type coercion before doing the comparison. What it means is, it forces two values do…
Read article
The JavaScript interpreter is nice enough to add semicolons for us if we forget them. For most places this works, but then you get a bug that is impossible to fix, and the debugger doesn't give you the line number where …
Read article
It is common to see code where all variables are declared separately in JavaScript. When in a scope, or a function, we have tendency to declare variables in multiple places thinking they are isolated from one another. He…
Read article
Since the last time I tackled this issue, there has been some improvements to newer versions of JavaScript. The Array object now has the isArray() method. To check if an object is an array, all you have to do is pass it …
Read article
Eval is evil. Ok, it's not like it goes out at night and kill kittens but it is evil nevertheless.
Let's start from the least evil to the kitten killer.
Code passed through the eval compiler is run in a global namespace…
Read article