GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - kvdos/javascript-array-functions-practice: Want to learn how to use JavaScript array functions like map, reduce, filter, etc? Use this worksheet and the corresponding videos to figure out how!

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

4 Commits
4 Commits

Folders and files

NameName
Last commit message
Last commit date
ReadMe.md
ReadMe.md
 
 
index.html
index.html
 
 
worksheet.js
worksheet.js
 
 

Repository files navigation

Quick JavaScript Array Functions Practice

Want to learn how to use JavaScript array functions like map, reduce, filter, etc? Use this worksheet and the corresponding videos to figure out how!

Videos: https://www.youtube.com/playlist?list=PLDlWc9AfQBfZGZXFb_1tcRKwtCavR7AfT

Sample Data

Here's a sample piece of Star Wars data from the Star Wars API.

const characters = [
    {
        name: 'Luke Skywalker',
        height: '172',
        mass: '77',
        eye_color: 'blue',
        gender: 'male',
    },
    {
        name: 'Darth Vader',
        height: '202',
        mass: '136',
        eye_color: 'yellow',
        gender: 'male',
    },
    {
        name: 'Leia Organa',
        height: '150',
        mass: '49',
        eye_color: 'brown',
        gender: 'female',
    },
    {
        name: 'Anakin Skywalker',
        height: '188',
        mass: '84',
        eye_color: 'blue',
        gender: 'male',
    },
];

MAP

  1. Get an array of all names
  2. Get an array of all heights
  3. Get an array of objects with just name and height properties
  4. Get an array of all first names

REDUCE

  1. Get the total mass of all characters
  2. Get the total height of all characters
  3. Get the total number of characters in all the character names
  4. Get the total number of characters by eye color (hint. a map of eye color to count)

FILTER

  1. Get characters with mass greater than 100
  2. Get characters with height less than 200
  3. Get all male characters
  4. Get all female characters

SORT

  1. Sort by name
  2. Sort by mass
  3. Sort by height
  4. Sort by gender

EVERY

  1. Does every character have blue eyes?
  2. Does every character have mass more than 40?
  3. Is every character shorter than 200?
  4. Is every character male?

SOME

  1. Is there at least one male character?
  2. Is there at least one character with blue eyes?
  3. Is there at least one character taller than 200?
  4. Is there at least one character that has mass less than 50?

About

Want to learn how to use JavaScript array functions like map, reduce, filter, etc? Use this worksheet and the corresponding videos to figure out how!

Topics

arrayarraymethodseveryfilterjavascriptmapreducesomesort

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.