Warning: Parameter 1 to wp_default_scripts() expected to be a reference, value given in /var/www/whoknew.dk/public_html/wp-includes/plugin.php on line 601

Warning: Parameter 1 to wp_default_styles() expected to be a reference, value given in /var/www/whoknew.dk/public_html/wp-includes/plugin.php on line 601
JavaScript | Jacob T. Nielsen

Backbone.js declarative is-key events

You want to hide a dom element when some key triggers “keyup”. This is a fairly simple scenario where your code just might end up looking like this. So what is the problem? The problem is that closeDialog() has two very clear and very different responsibilities. 1. Determine what key triggered the “keyup” event 2. […]

JavaScript function memoization

I have previously written about JavaScript functions having properties. I provided a fairly simple example of how this works. Another way this can be utilized is when doing function memoization. Memoization optimizes speed of function execution by avoiding repeating calculations for previously passed inputs. This means that a memoized function remembers the computed result for […]

JavaScript function properties

One of my favorite parts of JavaScript is that functions are first-class objects. This might sound trivial but does, in fact, have some very useful implications in that a function is just a type of object with the same behavior as “regular” objects. As an example: a function can return a function, have properties and […]

Debugging remote iframed sites

NOTE: This article is focused on users of Windows. The principles, however, should be the same for other operating systems. The software product which I work on allows for it to be iframed. Furthermore, our product dispatches a series of JavaScript events that the web page which iframes it can act on. As an example, […]

5 JavaScript assumptions that stole my time

Through my career, I have come to the realization that “assumptions” is in itself an area with a lot of depth. As software developers, we constantly make assumptions about our own and other people’s code not to mention the languages and tools we work with. When debugging we are required to challenge these assumptions, but […]