Created
August 4, 2015 22:52
-
-
Save kenmazaika/622b62777201f6b0d9dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <body> | |
| <p>Creating a JavaScript Object.</p> | |
| <p id="text"></p> | |
| <script> | |
| var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"}; | |
| var str = ""; | |
| for (var key in person) { | |
| if (person.hasOwnProperty(key)) { | |
| var value = person[key]; | |
| str = str + key + "=" + value + "<br />"; | |
| } | |
| } | |
| document.getElementById("text").innerHTML = str ; | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment