Beginner level · Module 3 of 5 · 10 guided hours
Arrays, Objects and Array Methods
Store collections in arrays and records in objects, transform data with map, filter and reduce, and read and write JSON.
Learning objectives
- Create and modify arrays and objects
- Transform data with map, filter, find and reduce
- Convert between objects and JSON text
Topics
- arrays and indexes
- push, pop, slice, splice
- objects and properties
- destructuring
- map, filter, find, reduce, sort
- JSON.stringify and JSON.parse
Lessons
-
Lesson 1 Arrays and Objects
Store lists in arrays and records in objects, read and change them, and unpack them with destructuring.
array index and lengthobject propertiesdot vs bracket notationdestructuring
-
Lesson 2 Transforming Data with map, filter and reduce
Use array methods to transform, select, find and summarise data without writing loops by hand.
mapfilter and findreducesort with a compare function
-
Lesson 3 JSON: Data as Text
Convert objects to JSON text and back, the format used to store data and exchange it with servers.
JSONJSON.stringifyJSON.parsetry/catch
Practical activity
Process a list of sales objects: add a total to each, keep sales above a threshold, sort them and sum the revenue.
Expected outcomes
- Data handled as arrays of objects
- Readable data transformations with array methods
Assessment
Practical: write five data transformations over a provided array of objects; marked by expected outputs.
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.