What is an object?

What is an object?

All data in JavaScript can be viewed as objects, and each object has its properties and methods.

The properties of an object reflect certain specific properties of the object, such as: the length of the string, the length and width of the image, the text in the text box (Textbox), etc.;

The method of an object can do something to the object, for example, "Submit" of the form, "Scrolling" of the window , etc.

For example, when applying for a variable:

var my_var="www.php.cn";

In fact, a string object is created. This object has The built-in attribute my_var.length = 10

At the same time, this string object also has several built-in methods, such as the my_var.toUpperCase() method that can convert characters to uppercase; the my_var.charAt(n) method Can return the nth character.

Continuing Learning
||
<html> <head> <script type="text/javascript"> var my_var="www.php.cn"; var mynum=my_var.length document.write("数组长度:"+mynum); </script> </head> <body> </body> </html>
submitReset Code