0

display the names of the students whose Ages are between 10-25

Write a JavaScript program to input the names and ages of 10 students into the program and display the names of the students whose ages are between 15 – 25.

11th Sep 2021, 3:07 PM
k.fathima Lasna
k.fathima Lasna - avatar
2 Antworten
+ 2
Step 1: Add 10 random students (objects) into an array. Step 2: Filter the array using filter. edit: I tried to not give him the actual whole solution.
11th Sep 2021, 3:31 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 1
const students = [ {name:"student1",age:08}, {name:"student2",age:19}, {name:"student3",age:38}, {name:"student4",age:17}, {name:"student5",age:56}, {name:"student6",age:09}, {name:"student7",age:24}, {name:"student8",age:13}, {name:"student9",age:25}, {name:"student10",age:51} ] students.forEach(student=>console.log(student.age>=15&&student.age<=25?student.name:'not eligible'))
11th Sep 2021, 3:35 PM
SAN
SAN - avatar