Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
JAVASCRIPT DATA / CHAPTER 02 / Learn / LESSON 01
Data chapter. Foundations gave you numbers one by one. Now we hold a list of amounts — an array.
Square brackets: const amounts = [12, 25, 40]; Order matters. amounts.length returns the count (here 3).
Mini example:
const tips = [5, 5, 10]; console.log(tips.length);
Common mistake: amounts = 12 (one number); or amounts.size instead of .length (that belongs to other structures).
.length returns how many items the array holds.
DATA STANDBY
›