Leaderboard Explainer


Aim of the puzzle: Use the indexOf() array method to get the position of an element in an array.
Walk through of solution: indexOf() takes an element as an argument, and returns the index number of that element in an array. It is important to remember that in JavaScript (and most programming languages), arrays start at 0. For example:

let fruit = ['apples', 'oranges'];

This will print out 0, as 'apples' is the 1st item in the array.

In this puzzle, we will use .indexOf() to find the position of 'YOU' in the highScores array.
To complete the puzzle, remove the 0 in let rank = 0, and replace it with highScores.indexOf('YOU').

Javascript is case-sensitive, so make sure capitalization is correct.

Sample code solution:

let highScores = [

let rank = highScores.indexOf('YOU');
console.log('You are number: ' + rank);

Javascript Concepts: Arrays, indexOf array method, Variable Declarations with let, console.log