For-In-2

 

Example of for-in:

 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <p id="sample"></p> <script> var txt = ""; var obj = {a:1, b:2, c:3}; for (var prop in obj) { txt+=obj[prop] + " "; } document.getElementById("sample").innerHTML = txt; </script> </body> </html>
Output