This article mainly introduces JavaScript to create an object and manipulate the use of object properties, examples of JavaScript using the object class to define objects and properties of the use, the need for friends can refer to the
This article illustrates the use of JavaScript to create an object and manipulate object properties. Share to everyone for your reference. The specific analysis is as follows:
The following JS code creates a Mymovie object and assigns values to the object title and director attributes, which are simple to define objects by object, and their properties can be invoked directly without definition.
?
1 2 3 4 5 6 |
<script type= "Text/javascript" > var mymovie = new Object (); Mymovie.title = "Aliens"; Mymovie.director = "James Cameron"; document.write ("Movie:title is" "+mymovie.title+" ""); </script> |
The output results are as follows:
?
1 |
Movie:title is "aliens" |
I hope this article will help you with your JavaScript programming.