Skip to content
Advertisement

How do I select the max value from an array?

I’m creating a elementary math tutorial, and for this portion I have an array, the array is filled with 5 random numbers, between 0 and 9. The question I am creating would give 5 random digits, and say “What is the highest number that you could make with these digits?”, and then I store that number in a variable

JavaScript

Advertisement

Answer

JavaScript

This should do what you require. Your highest value will be set to maxNo. Dont forget to import Java.util.*;

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement