Loading topic
if, while, and for condition in JavaScript accepts any value, not only true or false. Before the engine decides which way to go, it converts the value to a boolean. Values that convert to true are called truthy, and values that convert to false are called falsy. If you kn2 min readlet and const and that you are familiar with JavaScript's primitive types, arrays, and plain objects. Every condition you write later in this tutorial depends on comparisons, so you need to know exactly what each operator does.2 min read=== versus ==. An if statement runs a block of code only when its condition is truthy. The condition doesn't have to be a boolean. JavaScript converts whatever value you give i2 min readif statements. The logical operators && and || do more than combine conditions. They return one of their operands, and they skip the right side when the left side already decides the result. The nullish coa2 min readif/else statements. The conditional operator applies the same decision logic, but it produces a value instead of running a block of code.2 min readif/else if chains and know how strict equality (===) differs from loose equality (==). A switch statement takes one value and compares it against a list of case values. It is often easier to read than a long if chain that tests the same variable over 2 min readif statements from earlier chapters. You should also be comfortable declaring variables with let.2 min readlet and const, can index into arrays, and have read the previous chapter on while loops. A for loop is a while loop with its setup, test, and update moved into one line. That layout makes it the usual choice when you know how many times to repeat, or when you 2 min readfor loop and while loops from the previous chapters, and that you can read if statements and switch. A loop normally runs until its condition becomes false. The break and continue statements let you change that from inside the loop body.2 min readfor loop, break and continue, and array destructuring such as const [a, b] = pair. A for...of loop walks through the values of an iterable: arrays, strings, Maps, Sets, and other collections. It does not use an index counter, and you never write a 2 min readfor loop and for...of, and that you can create plain objects and arrays. The for...in loop looks similar to for...of, but it answers a different question. for...of asks "what values does this iterable produce?" for...in asks "what property names 2 min readfor loop works and that you can write arrow functions. You should also know what a closure is: a function that keeps access to variables from the scope where it was created. The question here is which variable a closure sees when it is created inside a2 min readfor...of, break, and truthy and falsy values from earlier chapters. Array iteration methods take a callback and run it once per element. Each method names the purpose of a common loop, so the reader can tell what the cod2 min readfor...of and array methods such as map from the earlier chapters. You should also be comfortable with promises and async/await: an async function returns a promise, and await pauses that function until a promise settles.2 min readif/else, switch, the ?? operator, and array methods such as filter and some from earlier chapters. The focus here is structure: how to arrange branches so a reader can follow them quickly.2 min read