Loading topic
var, let, and const, and have called functions with arguments before. It covers the function declaration: the oldest and most common way to define a named function in JavaScript. You will see how a declaration is6 min readvar, let, and const, write object literals with methods, and pass a callback to something like setTimeout or Array.prototype.map. You should also have read the previous chapter on function declarations, because this chapter keeps comparin7 min readvar, let, and const. It explains why you can sometimes call a function on a line above its definition and sometimes cannot, and what error you get in each c6 min readundefined when you meant to return an object, or hit a syntax error because of where a line break or an operator sits. This chapter covers5 min readlet and const behave before they are initialized (the temporal dead zone). Default parameters and rest parameters let a function's signature describe the values it expects, 5 min readthis from their surrounding scope, and that you know default and rest parameter syntax. Here we look at arguments, an older feature 6 min readthis works in each, as covered in the earlier chapters. You should also know that objects can inherit properties through a prototype, though you don't need to know the details of prototype chain5 min readthis is set for regular functions and arrow functions. This chapter applies those rules in the three places where they cause the most bugs: object methods, callbacks, and class fields. This chapter assumes you know method shorthand in object literals, basic class synt5 min readvar is function-scoped while let and const are block-scoped, and that this depends on how a regular function is called.5 min readif, a for loop, a `swit6 min readthis is bound, the arguments object, construc6 min read