javascript how to compare three numbers

Solutions on MaxInterview for javascript how to compare three numbers by the best coders in the world

showing results for - "javascript how to compare three numbers"
Carlos
16 Aug 2020
1function compare(num1, num2, num3) {
2	if (num3 > num2 && num1 > num3) {
3		return num1 + ' is the biggest number';
4	} else if (num2 > num1 && num2 > num3) {
5		return num2 + ' is the biggest number';
6	} else {
7		return num3 + ' is the biggest number';
8	}
9}
10var results = compare(10, 20, 30);
11console.log(results);