Working with Data
We'll dive deep into JavaScript data structures and control flow, touching on some new concepts and some old ones that you probably haven't used in a while.
-
Working with DataArrays
Like Objects, Arrays are required to get almost anything done in JavaScript. We'll look at the Array type in great detail, focusing particular how some built-in higher-order functions can make quick work of common jobs.
-
Working with DataEXERCISE: Map, Filter, Reduce
Using our knowledge of how higher order functions on the Array prototype work, we'll implement our own map, filter, reduce and forEach functions.
-
Working with DataControl Flow
Control flow statements like
if
andswitch
give us the ability to define various paths that our program can take, under different circumstances. We'll look at how these work in detail, including some non-traditional (but very useful) use cases. -
Working with DataEXERCISE: Versioned Documents
Progressive Web Apps often need to store data in some durable medium. It's a good idea to version long-living data since old data may need to work with new versions of the application. We'll use our newfound knowledge of control flow statements to "upgrade" a versioned data structure to the current version, so that the rest of our app need not worry about it.
-
Working with DataLoops and Iteration
While you're no doubt familiar with a
while
orfor
loop, there are other mechanisms in JavaScript for iterating over data (some of which are very new). We'll look at the differences between things likefor..in
andfor..of
loops, and refresh ourselves with often-forgotten concepts likedo..while
. -
Working with DataEXERCISE: Fibonacci Numbers
Implement a function that returns a Fibonacci sequence of a specified length. Ensure that your solution works for sequences up to 10 million numbers long!
-
Working with DataWrap up and recap
We'll recap all the ground we've covered today, and set our sights on tomorrow's agenda.