·  JavaScript – Syntax – Conditional Statements – for...in

 

- Info:

  - This tutorial shows how to use for...in conditional statements in JavaScript.

  - The for...in statement loops through the properties of an object.

 

- Example:

  - Create D\Temp\JavaScript\Test.html

 

    Test.html

    <script> 

   

      john = {

        name : "John",

        age  : 45

      }

      

      for (x in john) {

        document.write(john[x] + "<br>");

      }

   

    </script>

 

    output

    John
    45