Book Club: Eloquent JavaScript. 4 Programme Structure

ruthmoog - Jan 31 - - Dev Community

Eloquent JavaScript A Modern Introduction to Programming, by Marijn Haverbeke

Part i: Language


Sorry that this next chapter is later than expected, I had a lot going on at the end of last year including a new job as a Frontend Dev. But I will try to stay on track, please feel welcome to join in!

A pencil illustration from the book, of ferns and flying bumblebees

Illustration by Madalina Tantareanu

Chapter 2: Programme Structure

If you read any of this chapter, please go ahead and discuss what you thought in the comments!

📝 I've removed chapter 3 from this post (because I forgot there are exercises too!) and I've added my notes below.

📆 End of Feb 2024.

📚 On Storygraph? Join the Readalong!


Who should read this chapter?

This chapter is a general and basic overview of the terminology and syntax used in JS. So it will be useful to read carefully if you're new to programming, otherwise skim it. I find it difficult to use the terms in the book (e.g. 'binding' because I would usually say var or constant) but it's good to be aware of the vocab.

What do we learn?

In a nutshell, here we learn that programs are made of statements, which can contain statements including expressions, which can be made of expressions! Loops and conditions can interrupt the top-to-bottom control flow, with bindings for tracking state and filing data under a name. Functions are like blocks of program, where a function call is an expression which can produce a value.

Exercises

There are three fairly simple programming logic exercises at the end of the chapter, which are worth doing to practise loops - especially the classic FizzBuzz.
The hints provide a couple of solutions, so if you didn't need to use the hint, do read it after writing your solution.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .