जावास्क्रिप्ट की array.values() विधि एक नया Array Iterator ऑब्जेक्ट देता है जिसमें सरणी में प्रत्येक अनुक्रमणिका के मान होते हैं।
वाक्य रचना इस प्रकार है -
arr.values()
आइए अब जावास्क्रिप्ट में array.values() मेथड को लागू करें -
उदाहरण
<!DOCTYPE html>
<html>
<body>
<h2>Demo Heading</h2>
<p>Click the button to display the value...</p>
<button onclick="display()">Result</button>
<p id="test"></p>
<script>
function display() {
var arr = ['p', 'q', 'r'];
var res = arr.values();
document.getElementById("test").innerHTML = res.next().value
}
</script>
</body>
</html> आउटपुट

"परिणाम" बटन पर क्लिक करें -

उदाहरण
<!DOCTYPE html>
<html>
<body>
<h2>Ranking Points</h2>
<p>Click to display the points...</p>
<button onclick="display()">Result</button>
<p id="test"></p>
<script>
function display() {
var points = ['10', '20', '30', '40', '50'];
document.getElementById("test").innerHTML = (points.values()).next().value
}
</script>
</body>
</html> आउटपुट

"परिणाम" बटन पर क्लिक करें -
