JavaScript Foundations·Practice drills 14

Drill 22: Trade-off — Arrays and objects

Explain the trade-off in this example.

Beginner 5 min read Lesson 355 of 480 Challenge included
What you will be able to do
  • Explain the trade-off in this example.

Practice task

Explain the trade-off in this example.

arrays.jsJavaScript
const lessons = [
  { title: "Variables", done: true, minutes: 10 },
  { title: "Functions", done: true, minutes: 12 },
  { title: "Arrays", done: false, minutes: 14 },
];

const finished = lessons.filter((lesson) => lesson.done);
const titles = lessons.map((lesson) => lesson.title);
const totalMinutes = lessons.reduce((sum, lesson) => sum + lesson.minutes, 0);

const { title } = lessons[2];
console.log(titles, totalMinutes, title);
Your turn

Write your answer

Easy

Explain the trade-off in this example.

TEXT · starter
Your answer…
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Lesson 355 of 480 · 0% of course