ऐरे के मिन और मैक्स एलिमेंट प्राप्त करने के लिए, जावास्क्रिप्ट में Math.min() और Math.max() मेथड का उपयोग करें। न्यूनतम और अधिकतम एलिमेंट ढूंढने के लिए निम्नलिखित कोड चलाएं:
उदाहरण
<html> <body> <script> var arr = [50, 30, 70, 60]; document.write("Maximum Value: "+Math.max.apply(null, arr)); document.write("<br>Minimum Value: "+Math.min.apply(null, arr)); </script> </body> </html>आउटपुट
Maximum Value: 70 Minimum Value: 30