Keywords:
Situation:
You want to store a bunch of records in JS. Each record has the same fields.
Actions:
Use a record set. Make a JS array. Each element is a JS object, with the same properties.
Explanation:
Here is an example:
var catalog = [
{
id: 42,
title: "Web apps for happy dogs",
maxEnrollment: 40,
location: "Monty Hall 301"
},
{
id: 155,
title: "Databases for happy dogs",
maxEnrollment: 32,
location: "Monty Hall 301"
},
....
];
catalog
is a JS array. Each element is an object. Each object has the same properties: id
, title
, maxEnrollment
, and location
.