JavaScript: Get the highest number from three different numbers
JavaScript Math: Exercise-31 with Solution
Write a JavaScript function to get the highest number from three different numbers.
Test Data:
console.log(highest_of_three(-5, 4, 2));
4
Sample Solution:-
HTML Code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript function to get the highest number from three different numbers</title>
</head>
<body>
</body>
</html>
JavaScript Code:
function highest_of_three(num1, num2, num3)
{
return Math.max(num1, num2, num3);
}
console.log(highest_of_three(-5, 4, 2));
Sample Output:
4
Pictorial Presentation:
Flowchart:

Live Demo:
See the Pen javascript-math-exercise-31 by w3resource (@w3resource) on CodePen.
Improve this sample solution and post your code through Disqus
Previous: Write a JavaScript function to cast a square root of a number to an integer.
Next: Write a JavaScript function to calculate the percentage (%) of a number.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join