This post is part 87 of 92 in the series Programming by Stealth

In the previous instalment we started our redux and update of function objects in JavaScript. This fits into a larger mini-series within the larger series looking at all the different proverbial hats objects wear in JavaScript. The previous instalment was almost all redux, this one by contrast will be entirely dedicated to updated features added in ES6 that we’ve not seen before.

The instalment has a some-what strange structure because I felt it best to change my plans a little and extend the existing challenge by another week. Hopefully you won’t mind the slightly different flow of the sections compared to the norm.

You can download this instalment’s ZIP file here. If you prefer, you can access this instalment’s resources directly at the following links:

Read more

Tagged with:

This post is part 86 of 92 in the series Programming by Stealth

This is the third instalment in a mini-series within the PBS series looking at the many different roles objects fulfil in JavaScript. I’ve been describing these roles as hats, so up to this point we’ve looked at how JavaScript objects have a dictionary hat and an array hat. In future instalments we’ll see that JavaScript objects also have regular expression and string hats. Today though, we’ll start a two-part look at what is probably the most un-expected hat of all — the function hat. Yes, JavaScript uses objects to implement functions. That is to say, every JavaScript function is an object!

Because functions are so important, and because there is a lot of ground to cover, I’ve spread this topic over two instalments. This first instalment will be mostly (but not entirely) a redux, and most of the new content will be covered in the next instalment.

You can download this instalment’s ZIP file here (now via the JSDelivr CDN). If you prefer, you can access this instalment’s resources directly at the following links:

Read more

Tagged with:

This post is part 85 of 92 in the series Programming by Stealth

There are many programming concepts that are common to the vast majority of programming languages, but each language implements these concepts in their own unique and special way. In JavaScript, objects are used to implement many concepts. I like to think of JavaScript objects as a single language feature that wears many hats. In the previous instalment we focused on one of these hats, JavaScript’s use of objects to implement dictionaries. In this instalment we’ll look at another hat JavaScript objets get to wear — arrays. As with the previous instalment, this instalment will be a mixture of consolidated reminders of things we’ve met before, and of some new features added to arrays in more recent versions of the JavaScript language.

We’ll also look at a sample solution to the challenge set at the end of instalment 83, but unusually, we’ll do that after our look at arrays.

You can download this instalment’s ZIP file here (now via the JSDelivr CDN). If you prefer, you can access this instalment’s resources directly at the following links:

Read more

Tagged with:

This post is part 84 of 92 in the series Programming by Stealth

As we near the end of our initial exploration of client-side web technologies I want to re-visit some key JavaScript features so cement what we already know, and add some new features brought to the language in more recent releases of the ECMA standard that underpins JavaScript.

Since objects are so ubiquitous in JavaScript I want to start there, and I want to start with their most fundamental use, as so-called dictionaries.

You can download this instalment’s ZIP file here.

Read more

Tagged with:

This post is part 83 of 92 in the series Programming by Stealth

In this instalment we’ll finish our first exploration of Bootstrap 4 with a look at one its most versatile components, the so-called Card. This is one of those components that’s so generic it’s hard to describe, but once you learn about it you’ll start seeing it all over the web. Cards really are ubiquitous!

It’s important to stress that while we’re wrapping up our exploration of Bootstrap 4 with this instalment, that does not mean we’ve come close to covering every feature this impressive library offers. Instead, the aim was to cover the big-picture items, and leave you with enough experience to be able to learn the rest independently by reading Bootstrap’s excellent documentation.

You can download this instalment’s ZIP file here.

Read more

Tagged with:

This post is part 82 of 92 in the series Programming by Stealth

In this instalment we finish our exploration of promises with a look at the two new promise-related keywords added to JavaScript in ES 2017. These keywords allow us to write asynchronous code in a more human-friendly way.

You can download this instalment’s ZIP file here.

Read more

Tagged with:

This post is part 81 of 92 in the series Programming by Stealth

So far in our exploration of promises we’ve learned the core concept — a promise is an object that represents the status and/or result of an asynchronous task. Asynchronous tasks are inherently parallel, but we’ve learned how to use .then() and .catch() to create so-called promise chains, allowing promises to be executed in series. What we’ve not looked at yet is JavaScript’s native Promise class. This class is primarily used to create promises, but it also provides some useful utility functions. For now at least, we’re focusing on using promises rather than creating them, so we won’t be digging into how the Promise class’s contractor works. However, some of the utility functions are designed to help developers use promises in more powerful ways, so those will be our focus for this instalment. The most powerful of these utilities is Promise.all(), a function that allows us to create promise chains that perform some tasks in series, and others in parallel, allowing us to efficiently manage our asynchronous tasks.

You can download this instalment’s ZIP file here.

Read more

Tagged with:

This post is part 80 of 92 in the series Programming by Stealth

In the previous instalment we got our first introduction to the concept of promises in JavaScript. By the end of the instalment we’d learned how to use promises to deal with single asynchronous tasks, but not how to use promises to deal with multiple interdependent asynchronous tasks. That’s what we’ll be focusing on in this instalment. In the previous instalment we looked at the arguments to .then(), but we ignored its return value. It’s the return value from .then() that this instalment revolves around. That return value is the key to dealing with interdependent asynchronous tasks by combining multiple promises into so-called promise chains.

You can download this instalment’s ZIP file here.

Read more

Tagged with:

This post is part 79 of 92 in the series Programming by Stealth

Finally, after much teasing, we get our first taste of JavaScript Promises! This will just be a taste though, Promises are simultaneously really simple and really counter-intuitive. In many ways teaching promises reminds me a lot if teaching recursion — there is a tipping point where the concept goes from infuriatingly mind-bending to obvious and logical. Getting to that tipping point can be quite the challenge though.

So, we’re going to take it slow with promises. They will provide us with a way out of callback hell, but that path to salvation is unlikely to be obvious to you by the end of this instalment. It will take one or two more instalments until we get that far. All I can ask is that you please trust, me, how ever bumpy the journey gets, the destination is worth the struggle!

You can download this instalment’s ZIP file here.

Read more

Tagged with:

This post is part 78 of 92 in the series Programming by Stealth

For boring real-life reasons this instalment is a bit of an intermission. In the previous instalment we learned about so-called call-back hell, and were all set to learn how Javascript Promises would be our liberation, but that’s going to have to wait until next time. Promises are a very important concept, and I don’t want to rush them.

What we’re going to do in this instalment is focus entirely on my sample solution to the challenge set at the end of the previous instalment, which I’ve used as an opportunity to demonstrate two new tools to add to our programming tool belt — the micro-checking library is.js, and Bootstrap Popovers.

You can download this instalment’s ZIP file here.
Read more

Tagged with:

« go backkeep looking »