<html> <head> <title>Property Setter</title> <script> // Create an object: var car = { color: "Red", brand: "Ford", set company(value) { this.brand = value; } }; document.write("Company =" + car.brand + <br>); car.company="BMW"; // Display data from the object using a getter: document.write("Company =" + car.brand); </script> </head> <body> </body> </html>
Company =Ford
Company =BMW