Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
NotificationsYou must be signed in to change notification settings

coding-in-public/vanilla-javascript-challenges

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Here goes the short description of the challenge...

BEGINNER CHALLENGES

unless otherwise stated, use thenames array in all challenge points.

constnames=["Derek","Joe","Anna","Coen","Chris","Macey","Ella"];
  1. Add a name to the beginning of thenames array.
  2. Add a name to the end of thenames array.
  3. Remove the name you added to the beginning of thenames array.
  4. Remove the name you added to the end of thenames array (return the name to an original).
  5. Create a new array calledlowercasedNames with each name lowercased.
  6. Sort thenames array alphabetically.
  7. Find the index of"Chris".
  8. Create a new array calledafterChris with all names after"Chris" in thenames array.
  9. Alter the original array to only contain the names before"Chris".
  10. Returntrue if thenames array contains"Chris" andfalse if it does not (hint: it should befalse now).
console.log(names);

INTERMEDIATE CHALLENGES

unless otherwise stated, use thepeeps array in all challenge points.

constpeeps=[{id:1,name:"Chris",age:24,favoriteNumbers:[1,4,8,12,32],},{id:2,name:"Terrance",age:37,favoriteNumbers:[2,8,9],},{id:3,name:"Megan",age:22,favoriteNumbers:[23,14],},{id:4,name:"Juan",age:18,favoriteNumbers:[23,14,2],},{id:5,name:"Tina",age:42,favoriteNumbers:[12,9,1,4,18],},{id:6,name:"Lin",age:24,favoriteNumbers:[3,9],},];
  1. Add a boolean propertyisAwesome for each peep and set it totrue if the person has at least 3 favorite numbers (orfalse if not).
  2. Return a new array calledyoungPeeps withpeeps 25 or younger.
  3. Sort thefavoriteNumbers property from least to greatest for each peep in thepeeps array.
  4. Returntrue if every person has an age below 50 andfalse if not.
  5. Create a function calledfindPeep that returns the peep for an ID passed in and returns"not found" if the peep does not exist. Call it for an id that exists and one that does not.
  6. Create a new array calledreversedPeeps with thepeeps array order reversed.
  7. Add an additional property on each peep object calledfavoriteNumbersSum with a single number value which equals the total of all their favorite numbers.
  8. Create a new array callednumberOnePeeps with all people that include a favorite number of"1". Include only their names and ids in the new array.
  9. Combine allpeeps from thenumberOnePeeps (#8 above) which are also in theyoungPeeps (#2 above) array into a new array calledfreshPeeps. Includepeeps with unique ids only from theyoungPeeps array.
  10. Return a single value representing the total of allfavoriteNumbers for anyone with theisAwesome property set totrue (hint: it should be 159).
console.table(peeps);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp