This post summarises the episodes streamed live (and available as recordings) on YouTube. Find out more about the Code at Home initiative in the main blog post: Let’s learn to “Code at Home”.

All the episodes are live streamed on my YouTube channel and are then available on that same channel after the streams finish, as recordings. In this post are links to those recordings with a short description of each. You can easily spot the upcoming live streams and recordings as they always have the “Code at Home” background in the thumbnail, like this:

# Episodes

Here are the recordings of the live stream episodes so far. Click on the episode title link to get to the recording on YouTube.

Episode Description
Fri 27 Mar 2020
Code at Home Ep.1
Setting up for our first challenge

In this first episode we set up the tools that we need - the Project Euler and the repl.it websites. We also solve together the very first problem described on Project Euler: Multiples of 3 and 5.

Code resources for this episode: CodeAtHome1

Mon 30 Mar 2020
Code at Home Ep.2
Fizz-Buzz and Fibonacci

We start off by looking at the little "homework" challenge from last time, with a program to generate the output of a Fizz-Buzz game. Then the main part of this episode sees us take a first look at the Fibonacci sequence, what it is and how to work out the termns in that sequence, coding together a simple program to do that.

Code resources for this episode: CodeAtHome2 and FizzBuzz

Wed 01 Apr 2020
Code at Home Ep.3
Solving a Fibonacci related challenge

Following on from the previous episode we take another look together at what we wrote already to generate the Fibonacci sequence, and rewrite it to make it better, using a generator function and even creating a function that produces other functions. With that, we go and solve Project Euler problem 2: Even Fibonacci numbers.

Code resources for this episode: CodeAtHome3

Fri 03 Apr 2020
Code at Home Ep.4
Figuring out sentence statistics!

Taking a break from numbers, we start to look at sentences and words, and how to parse them to grab basic data. In doing this we learn about arrays, and how to create and use them, even discovering functions and properties that are available on them. We also start to introduce the 'const' and 'let' keywords, and end with a gentle introduction to the super 'map' function.

Code resources for this episode: CodeAtHome4

Mon 06 Apr 2020
Code at Home Ep.5
More on arrays and array functions

Continuing on from the previous episode we start off by taking a look at character codes to understand the default sort() behaviour, digging in a little bit to the ASCII table. Then we look at a few more array functions, revisiting split() and map() and finally building a predicate function isPalindrome() that will tell us if the input is palindromic, a useful function that we'll need to solve Project Euler problem 4 in the next episode.

Code resources for this episode: CodeAtHome5

Wed 08 Apr 2020
Code at Home Ep.6
Solving the palindromic products puzzle

We start off by making slight improvements to our isPalindrome() function so that it will work with numbers as well as strings. Then we generate pairs of numbers in nested for loops, implementing an optimisation that will leave out duplicate calculations. We then check whether our code agrees with the answer to the sample in the problem (the product of two 2-digit numbers) and confident that it's OK, we put the code to work to calculate the main part of Project Euler problem 4, and it works!

Along the way, we define a function that we then use to influence the behaviour of the sort() function. Between now and the next episode, think about how this function works, by looking at the Array.prototype.sort documentation at MDN.

Code resources for this episode: CodeAtHome6

Fri 10 Apr 2020
Code at Home Ep.7
Looking at sort functions

In this episode we dig more into why the default sort behaviour for our filtered palindromic products wasn't quite what we wanted, and looked into how the sort() function can use a 'compare function' to tell it how to behave. Then after creating a useful function to generate a nice list of random numbers on demand, we explore our own compare function implementation, passing it to sort() to influence the behaviour. Lots of fun!

Code resources for this episode: CodeAtHome7

Mon 13 Apr 2020
Code at Home Ep.8
Finishing off sort, and introducing objects

In this episode we expand our horizons with respect to arrays, and learn how you can have arrays with different types of data, and even nest arrays inside each other. We then move on to objects, which are an even more powerful way of representing and manipulating data. As a brief aside, we take an initial look at Project Euler Problem 4 - Names Scores, which we'll start to solve together next. Finally, we write another compare function to call sort() with, so that we can sort by referring to values of properties inside object structures.

Code resources for this episode: CodeAtHome8

Data resources for this episode: episodes-A.js which we copied into our repl.it workspace.

Wed 15 Apr 2020
Code at Home Ep.9
Looking at Project Euler problem Nr.22

We take a first proper look at the "Names Scores" problem, which is Nr.22 in the Project Euler series. There are a lot of things for us to do to solve the problem, but all of them definitely manageable. We spent a lot of this episode learning about how to open and read file contents, which we need to do to bring in the 5000+ first names that the problem is based upon.

Code resources for this episode: CodeAtHome9

Fri 17 Apr 2020
Code at Home Ep.10
Continuing with Project Euler problem Nr.22

Now we're comfortable with reading in the data from the file from the previous episode, we can turn our attention to starting to pick off each task we need to achieve to solve the problem. In this episode we look at stripping off the double-quotes from each name, and how to go about calculating individual letter scores for each name. We also take a brief look at the raw data that is provided to us from the file read process, and work out what it represents, by translating between hexadecimal and decimal and looking up values in an ASCII table.

Code resources for this episode (same as the previous episode): CodeAtHome9

Mon 20 Apr 2020
Code at Home Ep.11
An introduction to reduce()

In this episode we took our time over getting acquainted with the powerful Array.prototype.reduce() function, the 'big sister' of Array.prototype.map(), Array.prototype.filter() and other similar array functions. Unlike map() and filter(), both of which expect to be passed functions that take a single parameter, and both of which produce an array as a result, the reduce() function expects to be passed a function that takes two parameters, and can produce a result of any shape (e.g. an array, an object or a scalar). We used reduce() to add up an array of numbers.

Code resources for this episode (same as the previous episode): CodeAtHome9

Wed 22 Apr 2020
Code at Home Ep.12
Finishing off Project Euler Nr.22

In this episode we finish off the coding for Project Euler problem 22. In doing so, we look at a feature of the Array.prototype.map() function that we've previously ignored - the fact that not only does it pass the element to the function we provide to it, but also that element's position in the array that's being processed. We use this feature to get the position of the element, to work out the final score for each name. Great!

Code resources for this episode (same as the previous episode): CodeAtHome9

Fri 24 Apr 2020
Code at Home Ep.13
Looking at Base 2 and our next challenge

We start off by taking a peek at the next challenge which is Project Euler Nr.36 - Double-base palindromes where we have to check not only decimal but binary numbers for palindromic properties. So we take an excursion into binary, or Base 2, to understand how that works. Then we grab the isPalindrome() function from a previous CodeAtHome episode to reuse, and quite easily solve the problem together. Great!

Code resources for this episode CodeAtHome13

Mon 27 Apr 2020
Code at Home Ep.14
Refactoring to improve our code

There are nearly always opportunities to make improvements to code; whether that is for readability, performance, or other reasons. In this episode we looked at what we wrote for the solution we coded together on the previous episode and made a few improvements, by tweaking some values to make the calculation perform better, and by adding a "helper" function that we can use in lots of places and that encapsulates complexity that we can then forget about.

Code resources for this episode CodeAtHome14

Wed 29 Apr 2020
Code at Home Ep.15
Continuing our refactoring journey using 'range'

We refactored some of our code in the previous episode and in this one we continued to do so, creating our own utility module and moving functions into that, and then importing what we need to the main index.js file. Then before tackling our range() function we looked at how range() works in Python, so that we could emulate that, for consistency. Then we started to write a new version of our range() function accordingly.

Code resources for this episode CodeAtHome15

Fri 01 May 2020
Code at Home Ep.16
recursion (noun): for a definition, see 'recursion'

After finishing off our reworked range() function so that it behaved more like Python 3's range() function, we moved on to start looking at recursion - what it is and where it came from. It's a wonderful concept but does take some time to understand, so we started slowly by looking at how we might use a recursive function definition to add some numbers together - with no explicit looping!

Code resources for this episode CodeAtHome16

Mon 04 May 2020
Code at Home Ep.17
A little more exploration of recursion

In last Friday's episode we got our first taste of recursion, defining a recursive function sum() to add a list of numbers together. In this episode we had another look at that recursive definition to understand the pattern a bit more, with the base case and the main part, and then expanded our knowledge by creating a similar function mul() to multiply a list of numbers together, and making note of the (very few) things that had to change. Then we looked at what factorials were, and defined a recursive function to determine factorials for us. In fact, we defined it three different ways, ending up with a single-expression function that used the ternary operator. The definition was a little terse, but hopefully interesting!

Code resources for this episode CodeAtHome17

Mon 11 May 2020
Code at Home Ep.18
Looking at our next coding challenge together

We embark upon our last challenge for this series, which is Project Euler problem 52 Permuted Multiples, and take our time exploring the problem space in the REPL together. We build up solid little functions to help us out along the way, and to codify what our thoughts are, starting with digits(), contains() and sameLength(). We get to the stage where we can check through to see if all the digits in one number are in another number ... but we're not done yet, as we saw towards the end where we came across the 'subset' issue. We'll finish this off in the next episode, by looking at solving that (using sameLength()) and improving the comparisons with the array function every().

Code resources for this episode CodeAtHome18

Fri 15 May 2020
Code at Home Ep.19
Finishing off our challenge, improving the code

We did it! We finished off and solved Project Euler problem 52 together. In finishing off, we completed the isPermutation() function, which we needed to check two things, in sequence - first, whether the length of each number was the same, and then (and only if the lengths were the same) whether the digits in the first number were in the second number. We also created the meetsRequirements() function, and indeed wrote two versions of it, which checked the actual requirements of the problem, for each number we could throw at it - which we did in a simple while loop at the end.

Code resources for this episode CodeAtHome18