
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
How to print all students name having percentage more than 70% in JavaScript?
You can use a for loop and check whether the percentage is greater than 70 or not with if condition.
Following are the records of each student −
const studentDetails= [ { studentName:"John", percentage:78 }, { studentName:"Sam", percentage:68 }, { studentName:"Mike", percentage:88 }, { studentName:"Bob", percentage:70 } ]
Now, use the for loop and et conditions for students with percentage more than 70 −
for(var index=0;index<studentDetails.length;index++) { if(studentDetails[index].percentage > 70) { // } }
Example
const studentDetails= [ { studentName:"John", percentage:78 }, { studentName:"Sam", percentage:68 }, { studentName:"Mike", percentage:88 }, { studentName:"Bob", percentage:70 } ] for(var index=0;index<studentDetails.length;index++){ if(studentDetails[index].percentage > 70){ console.log("Student Name which has more than 70 %="+studentDetails[index].studentName); } }
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo68.js. This will produce the following output −
PS C:\Users\Amit\JavaScript-code> node demo68.js Student Name which has more than 70 %=John Student Name which has more than 70 %=Mike
- Related Articles
- In Class 7, 48 students passed out of 70 students. What is the percentage of students passed?
- JavaScript array: Find all elements that appear more than n times
- Select rows having more than 2 decimal places in MySQL?
- The percentage of marks obtained by a student in monthly unit tests are given below:Find the probability that the student gets more than $70 \%$ marks."\n
- Count all subsequences having product less than K in C++
- Print all nodes in a binary tree having K leaves in C++
- Find out the records of students with more than a specific score in MySQL?
- Print all prime numbers less than or equal to N in C++
- Aggregation framework to get the name of students with test one score less than the total average of all the tests
- What happens if the percentage of oxygen in the air reaches to 70%?
- Print all Semi-Prime Numbers less than or equal to N in C++
- Is element repeated more than n times in JavaScript
- Count of divisors having more set bits than quotient on dividing N in C++
- How to check android device having finger print sensor?
- On A Rainy Day Out Of 150 Students In A School 25 Were Absent. Find The Percentage Of Students Absent From The School. What Percentage Of Students Were Present?

Advertisements