Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Project JavaScript G2 Iterators

Topics: The .forEach() Method , The .map() Method , The .filter() Method , The .findIndex() Method , The .reduce() Method , Iterator Documentation , Choose the Right Iterator

Project Title: Good Mood Actions

  1. Create a html file with your name like john.html

  2. Add current code to that file:

<!DOCTYPE html>
      // your code here
  1. Create array actions of actions for good moods includes:
  • rest and refresh
  • connect with others
  • take time to enjoy
  • share interests
  • contribute to community
  • take care of yourself
  • challenge yourself
  • reduce your stress
  • notice the here and now
  • ask for help
  1. Log them into console with for loop.

  2. Log them into console with .forEach() Method.

  3. Log them as ordered list into console with composing .map() and .forEach().

  4. Filter items that start with c charachter and then as ordered list log them into console with composing .filter(), .map() and .forEach().

  5. Make array actionsLetters that holds number of letters in each item of the array (Note: do not count spaces).

  6. Do the sum of letters of all items in the array. Use .reduce() on the array of previous step.

  7. Find first item of actionsLetters that has less than 10 letters. Use .findIndex

Want to get reviewed?

Send Pull Request. Check how to deliver your code:

Need help?

Download Learn JavaScript eBook from

You can’t perform that action at this time.