JavaScript for Beginners #42 Coding Challenge 6

preview_player
Показать описание
Here, we will have a coding challenge that focuses on what we have learned with functions and loops.

0:00 Laying out the coding challenge
2:03 Creating our function
2:38 Creating a for loop
6:10 Fixing our ending for 3rd, 2nd, and 1st places
8:00 Adding in a 1st place emoji
9:10 Fixing our application to return a string
10:30 Using \n to create new lines in our application
11:15 Adding additional people to our array

//Create a function that takes in a multi-dimmensional array of the participants in a weight lifting contest, along with the total amount lifted.
//The function should print the name of the person, the amounts they lifted, and their place in the contest. The order should go backwards and give a trophy to the first place person.
//Modify the array to have more people and show that it still works. Let's use a max of 10 participants.

const malelifters = [["Jamie", 1050], ["Mark", 1020], ["Steven", 990], ["Max", 980], ["Gerald", 970], ["Brad", 955], ["Alex", 920]];
const femalelifters = [["Jenny", 400], ["Megan", 385], ["Alice", 365], ["Beth", 350], ["Becky", 320], ["Amanda", 300], ["Candice", 290], ["Jessica", 250], ["Mary", 220], ["Linda", 200]];

JavaScript Playlist:

MDN for Loops:

Node JS:

Visual Studio Code:
Рекомендации по теме
Комментарии
Автор

I started writing the if else statement for "myPlace" variable, but then I thought wait! GreeneMath will probably want to reinforce the switch statement with this task, so I ended up achiveving the same result with the switch statement :) P.S. The audio quality is top notch!

laponiec
Автор

Hi! When or in which type of scenarios would you say it's recommended to use the for loop and while loop?

r.josue.g
visit shbcf.ru