Blog

JavaScript Snippet – getClass()

If you have been using JavaScript for a little bit you probably already know how to determine a variable’s class constructor, but just in case you are overthinking it here is a hint: variable.constructor. 🙂 Of course, many times I like to make functions that will spit my results for Read more…

By Chris West, ago
Blog

JavaScript Snippet – String.prototype.after()

WARNING: Extending native prototypes is frowned upon by many JS engineers but can be helpful as long as the extensions are properly documented in the codebase. SCRIPTER’S DISCRETION IS ADVISED. 😆 Yesterday I added a post about String.prototype.before(...). As is explained within the post, this function can be used to Read more…

By Chris West, ago
Blog

JavaScript – Creating Classes

As many people know, JavaScript doesn’t really have classes but you can mimic some of their behavior with the prototypal setup available in JavaScript. Still, a lot of times it is just easier when you have a function that does most of the work for you. For that reason, I Read more…

By Chris West, ago
Blog

JavaScript – String.prototype.split Fix

In this post I proved that the String.prototype.split function can behave differently in IE8 and below than it does in other browsers. For that reason, I wrote the following code that will fix the issue so that split should work the same in all browsers: (function(split, toString, slice) { String.prototype.split Read more…

By Chris West, ago