JavaScript creates an object object and manipulates the usage of the object's properties

  • 2020-05-17 04:49:36
  • OfStack

This article illustrates the use of JavaScript to create an object object and manipulate its properties. Share with you for your reference. The specific analysis is as follows:

The JS code below creates an myMovie object and assigns values to the title and director properties of the object. Object defines the object, and its properties can be called directly without being defined. It is very simple.

<script type="text/javascript">
var myMovie = new Object();  
myMovie.title = "Aliens";
myMovie.director = "James Cameron";
document.write("movie: title is \""+myMovie.title+"\"");

The output results are as follows:

movie: title is "Aliens"

I hope this article is helpful to you in javascript programming.

Related articles: