Ayah's Students explainer

Aim of the puzzle: Find the key information in a word problem and solve the problem using code.
Walk through of solution: Ayah needs to figure out how many students in her class will need an adult ticket for their trip to the museum. The museum states that all visitors older than 12 must have an adult ticket.

In this puzzle, the studentList is imported from additional code. It contains an array of objects, each with a name and age property.

The function will need to be called with the studentList, so to start, add a parameter to the needsAdultTicket() function, for example, needsAdultTicket(list).

Then, inside the function, add a for loop to iterate through the parameter. Then, add an if statement that checks if the age property of each item in the array is greater than 12.

Inside the if statement, use console.log() to print the name property of the students who are older than 12.

Finally, call the function with studentList as an argument.
Sample code solution:

import { studentList } from 'class.students';

function needsAdultTicket(list) {
    for (let element of list) {
        if (element['age'] > 12) {
            console.log(element['name']);
        }
    }
}

needsAdultTicket(studentList);

Additional Code:

studentList: [
            {name:'Amelia',     age: 13},
            {name:'Anna' ,      age: 12},
            {name:'Charlotte',  age: 13},
            {name:'Claudia',    age: 13},
            {name:'Clyde',      age: 13},
            {name:'Emily',      age: 12},
            {name:'Jack',       age: 12},
            {name:'Kyle',       age: 13},
            {name:'Marcus',     age: 13},
            {name:'Rachel',     age: 12},
            {name:'Tony',       age: 12},
        ]

Javascript Concepts: Functions, Arrays, For Loops, If Statements, Objects, Properties