5 commonly used objects in JavaScript

5 commonly used objects in JavaScript

Preface:

I believe that those who build websites are very familiar with JavaScript . It is a scripting language. Unlike Python , it is a browser scripting language, while Python is a server scripting language. We must not only know Python , but also JavaScript , because it plays a big role in making web pages.

1. JavaScript Objects

There are many useful objects in JavaScript that can be used to implement many functions. In addition to the ones we have touched before, there are also the following:

Date Date RegExp Regular Error Error

Next, let’s take a closer look at what they are useful for:

1).Array object

It is the well-known array object, which can store many values ​​and access them using subscripts. Common operations are as follows:

2).Boolean object

/*Return the source code of the object*/
b.toSource() 
 
 
/*Convert a logical value to a string and return the result. */ 
b.toString() 
 
 
/*Return the primitive value of a Boolean object. */
b.valueOf() 


3).Date object

This object mainly operates on time. We can get and set the time through this object, as shown in the figure:

4).Math object

This object is just like the method in our Python math module, and both can be understood in the same way, as shown in the figure:

5). Number object

It mainly involves some operations on digital objects, which are relatively simple and have few methods, as shown in the figure:

6).String object

It mainly operates on string objects, such as string concatenation and segmentation. This is an object we often use. Its usage is as follows:

This concludes this article about 5 commonly used objects in JavaScript . For more information about commonly used objects in JavaScript, please search previous articles on 123WORDPRESS.COM or continue browsing the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Understanding Objects in JavaScript
  • Detailed explanation of Object in Javascript
  • Detailed summary of JavaScript objects
  • Five ways to determine whether an object attribute exists in JS
  • Summary of JavaScript custom object methods
  • JavaScript removes unnecessary properties of an object
  • When the springboot post interface accepts json, when it is converted to an object, the properties are all null.
  • Implementation of converting complex JSON string into Java nested object
  • Grasp the javascript object addition, deletion, modification and query application and examples

<<:  Detailed explanation of DBeaver connecting to MySQL version 8 and above and solving possible problems

>>:  Execute the shell or program inside the Docker container on the host

Recommend

Solve the problem of resetting the Mysql root user account password

Problem description: The following error message ...

How to use JSZip compression in CocosCreator

CocosCreator version: 2.4.2 Practical project app...

File sharing between Ubuntu and Windows under VMware

This article records the method of sharing files ...

Docker-compose quickly builds steps for Docker private warehouse

Create docker-compose.yml and fill in the followi...

How to use docker+devpi to build local pypi source

Some time ago, I needed to use pip downloads freq...

JQuery implements hiding and displaying animation effects

This article shares the specific code of JQuery t...

Summary of 10 advanced tips for Vue Router

Preface Vue Router is the official routing manage...

CSS3 sample code to achieve element arc motion

How to use CSS to control the arc movement of ele...

Detailed tutorial on distributed operation of jmeter in docker environment

1. Build the basic image of jmeter The Dockerfile...

Webpack builds scaffolding to package TypeScript code

Create a folder Directory structure: dabaots Init...