Home >Web Front-end >JS Tutorial >Introduction to JS objects_js object-oriented

Introduction to JS objects_js object-oriented

WBOY
WBOYOriginal
2016-05-16 18:36:201440browse

JavaScript is an Object Oriented Programming (OOP) language.
JS is an Object Oriented Programming (OOP) language. (You can search whether it is object-based or object-oriented here)
An OOP language allows you to define your own objects and make your own variable types.
OOP language allows you to define your own objects and variable types.

-------------------------------------------------- ------------------------------------
Object Oriented Programming
Programming of placed objects
JavaScript is an Object Oriented Programming (OOP) language. An OOP language allows you to define your own objects and make your own variable types.
JS is an (OOP) language, which allows you to define... .(Repeat of above)
However, creating your own objects will be explained later, in the Advanced JavaScript section. We will start by looking at the built-in JavaScript objects, and how they are used. The next pages will explain each built-in JavaScript object in detail.
However, we will introduce creating custom objects in advanced JS later. We'll start by looking at built-in JS objects and how to use them. The next page will introduce each built-in JS object in detail
Note that an object is just a special kind of data. An object has properties and methods.
Note that an object is just a special kind of data. Objects have properties and methods

--------------------------------------------- -------------------------------------
Properties
Properties
Properties are the values ​​associated with an object.
Properties are the values ​​associated with an object.
In the following example we are using the length property of the String object to return the number of characters in a string:
The following example uses the length property of a String object to return the number of characters:

The output of the code above will be:
The above code will output:
12

---- -------------------------------------------------- -----------------------------
Methods
Methods
Methods are the actions that can be performed on objects.
Object's methods can perform behaviors.
In the following example we are using the toUpperCase() method of the String object to display a text in uppercase letters:
In the following example we are using the toUpperCase() method of the String object to display a text in uppercase letters:

The output of the code above will be:
The output of the above code:
HELLO WORLD!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn