Blog

JavaScript – Global Eval

One of the supposedly evil things that is available in jQuery is eval. The type of eval that is available is of the global variety. In other words globalEval provides the ability to execute JavaScript code from a string in the global scope. Most people don’t realize it, but eval Read more…

By Chris West, ago
Blog

JavaScript – Date Difference Function

A few months ago I wrote a blog post about extensions to the Date.prototype. That post provided ways to add date parts and subtract date parts. Today’s post shows you how to use a generic Date.prototype.diff() function to find the difference between two dates and optionally return a string specifying Read more…

By Chris West, ago
Blog

JavaScript – Number.getOrdinalFor()

Now Available in YourJS When dealing with numbers, at times for presentation’s sake, we need to add ordinals to numbers. For example, instead of today is the “September 28”, you may want to say that it is the “28th of September”. I wrote the following code snippet to easily add Read more…

By Chris West, ago
Blog

JavaScript – Date.prototype.format()

Sometimes you write code that you wish you could totally rework. That is how I feel about jPaq’s Date.prototype.format(). The real issue I have with it is that the metacharacters are not intuitive. Therefore, I decided to write a new version of this function which is more intuitive. The following Read more…

By Chris West, ago