Radix Default for parseInt()

So, recently I see that parseInt() now defaults to radix of 10 in most modern browsers. However, it is still best practice to specify the radix when using parseInt() because you can’t guess the browser the user is on. I used to get burned on this gotcha with something like


The default radix used to be octal which would make code snippet’s output 0.

It is great that the default is now radix 10 but best practice is to always specify the radix.

Graceful page rendering during page delays

Let’s say you have a page where the presentation dependencies are the javascript code. Usually, all your style tags are placed in the header prior to the remaining elements are rendered. Your javascript is a JQuery plug-in (e.g., some-plugin.js)that takes some element and does some kind of styling to it by applying some CSS classes using its own CSS file(e.g., some-plugin.css).
Continue reading