2014-04-23

Handling required parameters in ECMAScript 6

In ECMAScript 5, you have a few options for ensuring that a required parameter has been provided, all of which are somewhat brittle and inelegant:
    function foo(mustBeProvided) {
        if (arguments.length < 1) throw new Error(...)
        if (! (0 in arguments)) ...
        if (mustBeProvided === undefined) ...
    }
In ECMAScript 6, you can (ab)use default parameter values to achieve more concise code (credit: idea by Allen Wirfs-Brock):

2014-04-15

What is the true nature of lions and hyenas?

Kevin Richardson is a South African zookeeper who has been accepted into several clans of spotted hyenas and prides of lions. His years-long relationship with these animals illustrates a different side of them: they can be affectionate and cuddly. Given how many atrocities humans commit to get their food, you have to wonder what one should consider the “true nature” of lions and hyenas. More information:

2014-04-10

2014-04-09

In search of the perfect technology for slides

I many cases, if you are presenting in front of an audience, you will create slides, visual material of some kind. I’m a very visual person myself and learn much better if I can read in addition to listen. Slides are also helpful when you lose attention for a few seconds.

There are a variety of software technologies out there for helping you with creating slides. Following are ones that I find intriguing:

2014-04-02

Making checkbox labels clickable via <label>

The <label> element has been around for a while, but I still don’t see enough websites use it. In lets you make labels of checkboxes and radio buttons clickable.

2014-03-20

reduce() and array indices

This blog post explains how the index works that Array.prototype.reduce() passes to its callback.

2014-02-20

Taking a break

I’ll be back on Monday, 17 March 2014 and will announce if and how 2ality will continue.