Làm web (js03) - JS: Arrays, Logic and Loops

Bài trước: Làm web (js02) - JS: Programming Basics
----------


3         Arrays, Logic, and Loops


In this chapter, we’ll look at some of the data structures used in JavaScript to store lists of values. These are called arrays, sets, and maps. We’ll also look at logical statements that allow us to control the flow of a program, as well as loops that allow us to repeat blocks of code over and over again.

This chapter will cover the following topics:

– Array literals

– Adding and removing values from arrays

– Array methods

– Sets

– Maps

– if and else statements

– switch statements

– while loops

– do … while loops

– for loops

– Iterating over a collection

– Project ― we’ll use arrays, loops and logic to ask multiple questions in our quiz


3.1       Arrays (p89)


3.2       Sets (p103)


Lab 5. Using the prompt to input fullname. Then output characters that used to make the fullname. For example, input: nguyen teo; output: n, g, u, y, e, t, o.

Lab 6. Remove duplicated items in array. For example, inputArray = [1, 2, 4, 5, 1, 3, 5, 6, 7, 3, 5, 4, 7], outputArray = [1, 2, 4, 5, 3, 6, 7]


3.3       Convert Sets to Arrays (p108)


3.4       Maps (p111)


3.5       Convert Maps to Arrays (p115)


3.6       Logic (p115)


3.7       Loops (p119)


3.8       Labs:


Lab 7. Quiz Ninja Project (p128)


-----
Cập nhật: 23/10/2019
-----