JavaScript Tutorials

  • By
    JavaScript Regex: String Does Not Contain

    For some reason I think that regular expressions can solve every problem and for some reason I always find out the regular expression I'm trying to create is too complicated and probably not the best route to getting what I want.  Case in point:  I needed to...

  • By
    Template Literals

    Seemingly every language has a template string enhancement, and within JavaScript we've written our own to allow more seamless development without the need to concatenate everything.  Some of these template helpers even allow for looping, iteration, and conditional support.  Native implementations always start small but I'm excited about template literals in...

  • By
    Tweet For Code #4

    You don't need a thousand lines of code to make a big difference in any coding language.  Oftentimes it's quite the opposite:  a few tiny code snippets can do a world of good and accomplish big things.  I asked my Twitter followers to tweet to me...

  • By
    Access Intern Command Line Arguments

    SitePen's excellent client side testing tool, Intern, comes with an excellent command line utility to run tests and customize how those tests are run.  The options provided are great but what if I want to make the command line more dynamic?  What if I...

  • By
    Safe Function Calls with attempt

    As browser implement new APIs, the truth is that though the APIs provide more power, I'd argue they bring about more volatility.  Whether it's the API that's the issue or us trying to use it, you're bound to run into errors which may break parts of...

  • By
    Remove UTM Parameters from URLs

    If you've ever worked on a social media campaign, you're probably familiar with the UTM tracking pieces of a URL which allow you to tie visits and pageviews with a given campaign.  They're a marketing person's dream but ugly for end users to look at.  And if you don't want your statistics...

  • By
    Element.offsetHeight for Visibility

    One of the (perceived) tricky tasks within front-end coding is checking if an element is visible or not.  The very naive way of checking if an element is visible (i.e. has presence or takes up space on the page) is by checking its display style value: Notice...

  • By
    Feature Detection and Function Efficiency within JavaScript

    Efficiency in code execution is incredibly important, especially when the given function is used repeatedly.  You often see repeated function calls within JavaScript frameworks.  When you work on said frameworks, you need to ensure you've hit ever micro-optimization possible.  One micro-optimization you can make is running...

  • By
    For and against `let`

    In this post I'm going to examine the case for (and perhaps against?) one of the new features coming in JavaScript ES6: the let keyword. let enables a new form of scoping not previously accessible generally to JS developers: block scoping. Function Scope Let's briefly review the basics...

  • By
    Detect Inverted Color with CSS and JavaScript

    There was something that bugged me after reading David's article on the invert filter last week. It was this sentence: The values reported back by window.getComputedStyle(el) will be the original CSS values, however, so there's no way of getting the true inverted values of given properties. But...