Квиз по JavaScript: map, filter & reduce

This JavaScript quiz checks how well you know the array methods you use every day. You will predict what map(), filter(), reduce(), find() and forEach() return and catch the traps that bite beginners, like a missing return or reduce() on an empty array.

Средний 10 вопроса ~6 минуты Проходной балл: 80% Node.js 22

Выберите режим

Вы играете как гость: войдите, чтобы сохранить XP и серию.

Пример вопроса

Вопрос 1 из 10

What does this print?

const nums = ["1", "2", "3"].map(parseInt);
console.log(nums.join(" "));
Показать ответ

B. 1 NaN NaN map() calls the callback with (item, index, array), so parseInt gets the index as its radix: parseInt('2', 1) and parseInt('3', 2) are NaN. Write .map(s => parseInt(s, 10)) or .map(Number) instead.

Что проверяет этот квиз

  • What map() and filter() return, and what their callbacks receive
  • reduce() with and without an initial value
  • find() vs filter() vs forEach()
  • Chaining array methods
  • Arrow function bodies that forget to return

Частые вопросы

Нужен ли аккаунт?

Нет. Играть может любой. Войдите, чтобы сохранять XP, серию, значки и историю.

Можно пройти ещё раз?

Да. Лучший результат сохраняется, а вопросы и ответы каждый раз перемешиваются.