Loading topic
let and const, work with arrays and objects, and read template literals. You should also know the difference between a parameter (the name in the function definition) and an argument (the value passed in the call), which the previous c4 min readlet and const, and read template literals. It also builds on the previous chapter: a parameter with no matching argument is undefined.3 min readfunction f(x = 1) {} from the previous chapter. Here we look at the exact rule that decides when a default is used. JavaScript checks one condition, and code that gets4 min readname = "guest", and know that defaults apply only when an argument is undefined. Here we look at when a default expression runs. It runs each time the function is called without that argument, an4 min readname = "guest". It also assumes you know that a default is used only when the argument is undefined, and that the default expression runs again on every call. Here the question is what 4 min readundefined, and the default expression is evaluated each time the function is called, when it is needed. Together these rules give you a short way to make a parameter mandatory.3 min readmap, reduce, join), and read template literals. It also builds on two earlier chapters: extra arguments are ignored when no parameter receives them, and the legacy arguments object holds every argume4 min read...rest) as covered in the previous chapter. It covers the reverse operation: you have the values in an array and need to pass them to a function as separate arguments.4 min readlength property. It tells you how many arguments the function "expects". That sounds simple. Once a parameter list includes default values or a rest parameter, though, the number often differs from what you see in the source. This chapter covers the exact counting r4 min readundefined. It shows how to combine those three ideas into a function signature that takes named, optional settings.4 min readlet and const, and work with arrays and objects. It explains one question that causes many real bugs: when you pass a value into a function and the function changes its parameter, does the caller see the change?4 min readreturn statement, the value a caller receives, and the undefined that JavaScript supp4 min readundefined when it reaches its end without a return. That rule was covered in the previous chapter. Here the focus is on where you place return statements and why placing some of them at the top of a fu4 min read(x) => x * 2, that you know a function without return produces undefined, and that you are comfortable with object literals and array methods like map and filter. The focus is narrow: how an arrow function decides whether to return4 min readreturn works and how a function returns undefined when it has no return value. Both are covered in "Returning Values and the Implicit undefined." You should also be comfortable with object literals and arrow functions.4 min read.then() and .catch(), and that you have seen await used inside an async function. It builds on the earlier chapters about return, implicit undefined, arrow functions, and the required-parameter pattern.4 min read