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 06
Sixth class. A budget is a list of records — an array of objects:
const items = [ { category: "food", amount: 12 }, { category: "rent", amount: 40 }, ];
items.length is the record count. Later we will filter and find by category.
Mini example:
console.log([{ amount: 1 }, { amount: 2 }].length);Common mistake: commas between fields inside an object, but a missing comma between objects in the array.
You combine [] and {} — a list of records.
DATA STANDBY
›