Prev Demo
Creating Object By Using Object Sonstructor.
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>Creating object using object constructor</h1> <script> var shoe = new Object(); shoe.color = "blue"; shoe.type = "sports"; shoe.size = 8; shoe.howComfortAmI = function () { console.log("Very Very Comfortable"); } alert("Shoe (object) are very very comfortable") </script> <p><strong>Note:</strong> We have created object (shoe) wit the proerties as color, size, type.<br> <br> We have given comfortableness function to the object, that will return the shoe comfortablness in the alert.</p> </body> </html>
Note: We DO NOT save your trial code in our database.
Output