A (Re)Introduction to JavaScript

By mike geyser

Elevator Pitch

JavaScript is weird. It is a product of its failures as much as its successes. Modern, yet outdated. Loved, yet reviled. This talk will attempt to (re)introduce this contrarian language, speaking to novices and veterans alike. It will show which parts of it you can use, and when you should use them.

Description

JavaScript is weird. It is a product of its failures as much as its successes. As a language, it is both modern and outdated. Cross platform, yet not. Interpreted, but can be compiled. Loved, yet reviled. ‘Good’ JavaScript written a year ago looks very different to what one might write today, never mind code written 10 years ago. Every year a new set of features is ratified into the ECMAScript standard, and is rolled out by browser manufacturers. This continual evolution can be frustrating and confusing, but provides us with a unique opportunity. To embrace change, unlearn what we take for granted, and fall in love with JavaScript (again).

This talk will attempt to (re)introduce this contrarian language, addressing novices and veterans alike. It will make fun of JavaScript’s foibles, mitigate its faults, and emphasize its strengths. It won’t attempt to divorce it from context, but will show which parts of the language you can use and when you should use them.

Notes

Talk Structure

I will start the talk with a brief (and hopefully comical) introduction, and then move into making fun of some of the bizarre idiosyncracies of JavaScript - such its floating point operations and type coercion. This part will be no longer than 5 minutes.

I’ll look at the importance of this, and how many ways you can make mistakes with it. I’ll use the humble for loop as an extended example of the behaviour, as well as how new language features improve it. This should take about 5 minutes all-in-all.

I’ll then take this a step further away from the joking and to how we used to write JavaScript applications, particularly looking modularisation using IIFE’s and explicit prototypal inheritence. I won’t spend very long on this, but the purpose will be to show how awful and bizarre things used to be. I’ll immediately talk about new patterns with modules and classes, how you can use them. There will be a big focus in both the browser and Node, how they differ, as well how they transpile in the two different platforms. This will be a long section at about 10 minutes, and there’s a lot of detail in it.

The next part of the talk will discuss the role of non-blocking code in JavaScript, why the event loop works like it does, and why (almost) everything should be async. It will discuss the design of all of the new web apis, as well how new language features (like async/await) mitigate some of the inherent complexity - and make the language both very powerful, as well as very expressive. This section will take about 10 minutes.

The last thing I’ll cover is how functions have always been first class citizens, and now the trend towards more functional software design is well suited to JavaScript. I’ll cover ‘fat arrow’ shorthand, why it’s so useful, and how to use it functionally. I’ll then move onto concepts of immutability and show the language features that we commonly use to copy, clone, and lock objects in javascript. This section should be about 10 minutes.

I’ll end off with a rapid-fire list of new features that are coming, and how they make the language far more expressive. I will end off by showing the full example of ‘old’ JavaScript to ‘new’ JavaScript, to illustrate the difference before ending. This part will take 5-10 minutes, depending on how much time is available.

Why this talk?

JavaScript changes very quickly. The web can be very confusing to get into, and it’s only growing worse. I think it’s really important that we discuss best practice, both for those new to development as well as those that have some dated web experience. It’s essential that we make things seem less intimidating to start.