How to get the max value within a list of numbers
I was trying to calculate max value within a list of numbers. Can you make it without using a loop? ... I started with the same solution as spider pig showed, and that made me wondering if anything faster is possible.
<!doctype html> <head> <meta name="author" content="puravidaapps.com"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> </head> <body>
<script> // get the list from the window.AppInventor object, remove the quotes and split at comma arr = window.AppInventor.getWebViewString().replace(/"/g,'').split(","); // find the max and print it to the title window.document.title = Math.max.apply(Math, arr); </script>
</body> </html>
Comments
Post a Comment