<!DOCTYPE html>
<html lang="en-US">
<body>
<script>
var myFruit = [];
myFruit["red"] = "Apple";
myFruit["yellow"] = "Banana";
myFruit["green"] = "Jackfruit";
var iterator = myFruit.keys();
for(let key of iterator)
document.write(key + "<br>");
</script>
<p><strong>Note</strong>: This example writes nothing because 'myFruit' array is empty.</p> </body>
</html>