<!DOCTYPE html>
<html lang="en-US">
<body>
<h1>JSON Arrays</h1>
<p id="point"></p>
<button onclick="myFunction()">Click Me</button>
<script>
var x = document.getElementById("point");
var temp = "";
var data = [
{
"name": "Mike",
"age": 36,
"number": [1, 12, 33, 64]
}
]
function myFunction(){
var myArray = data[0].number;
for(var i = 0; i < myArray.length; i++){
if(myArray[i]%2 == 0)
temp += myArray[i] +" ";
}
x.innerHTML = temp;
}
</script>
<p><strong>Note</strong>: Click on the button to display only 'even' numbers.</p> </body>
</html>