项目
在 GitHub 查看
jamesqquick/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!
学习与教育实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文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!
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
- Get an array of all names
- Get an array of all heights
- Get an array of objects with just name and height properties
- Get an array of all first names
REDUCE
- Get the total mass of all characters
- Get the total height of all characters
- Get the total number of characters in all the character names
- Get the total number of characters by eye color (hint. a map of eye color to count)
FILTER
- Get characters with mass greater than 100
- Get characters with height less than 200
- Get all male characters
- Get all female characters
SORT
- Sort by name
- Sort by mass
- Sort by height
- Sort by gender
EVERY
- Does every character have blue eyes?
- Does every character have mass more than 40?
- Is every character shorter than 200?
- Is every character male?
SOME
- Is there at least one male character?
- Is there at least one character with blue eyes?
- Is there at least one character taller than 200?
- Is there at least one character that has mass less than 50?
探索相关项目
加载中…