What are the common built-in objects in javascript and how to use them
This article introduces the knowledge of "what are the common built-in objects in javascript and how to use them?" in the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Common built-in objects in javascript are Array objects, Math objects, Date objects, and String objects. A built-in object is an object that comes with javascript itself.
This article operating environment: windows10 system, javascript 1.8.5, thinkpad T480 computer.
The built-in objects in javascript actually refer to the objects that come with javascript itself and provide some common functions.
There are four common built-in objects, which are:
Array object: provides an array model to store large amounts of ordered data.
Math object: can handle all mathematical operations.
Date object: can handle the storage, conversion, and expression of dates and times.
String object: can handle all string operations.
Example of mathematical object code:
Console.log (Math); console.log (Math.PI); / / output is π console.log (Math.floor (1.9)); / / rounding console.log down (Math.ceil (1.1)); / / rounding console.log up (Math.round (4.3)); / / rounding console.log (Math.abs (- 33)) / / take the absolute value console.log (Math.max (1, 2, 3, 4, 5)); / / take the maximum value console.log (Math.max.apply (null, [1, 2, 3, 4, 5]); / / null means that the this pointer does not replace console.log (Math.min (1, 2, 3, 4, 5)) / / take the minimum value console.log (Math.min.apply (null, [1,2,3,4,5]); console.log (Math.sqrt (100)); / / squared console.log (Math.pow (5,3)); / / Power, 5 to the third power console.log (Math.sin (90 * Math.PI / 180)) / / Sine, Radian = Angle * π / 180 console.log (Math.cos (180 * Math.PI / 180)); / / CoSine console.log (Math.tan (90 * Math.PI / 180)); / / tangent "what are common built-in objects in javascript and how to use them" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!