JavaScript ARRAYS of OBJECTS are easy! 🍎

Published: 21 November 2023
on channel: Bro Code
21,750
617

00:00:00 array of objects
00:01:29 access object properties
00:02:19 push()
00:02:59 pop()
00:03:11 splice()
00:03:28 forEach()
00:04:08 map()
00:05:18 filter()
00:07:09 reduce()

const fruits = [ {name: "apple", color: "red", calories: 95},
{name: "orange", color: "orange", calories: 45},
{name: "banana", color: "yellow", calories: 105},
{name: "coconut", color: "white", calories: 159},
{name: "pineapple", color: "yellow", calories: 37}];

// Access properties of a fruit object
console.log(fruits[0].calories);

// Add a new fruit object
fruits.push({ name: "grapes", color: "purple", calories: 62});

// Remove the last fruit object
fruits.pop();

// Remove fruit objects by indices
fruits.splice(1, 2);


Watch video JavaScript ARRAYS of OBJECTS are easy! 🍎 online without registration, duration hours minute second in high quality. This video was added by user Bro Code 21 November 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 21,750 once and liked it 617 people.