The built-in object of JS Foundation

Source: Internet
Author: User
Tags natural logarithm square root

String object: Handles all string operations
Math object: Handling all mathematical operations
Date object: Handling the storage, conversion, and expression of dates and times
Array object: Provides a model of an array, storing large amounts of ordered data
Event object: Provides various processing information for JavaScript events
Built-in objects have their own methods and properties and are accessed in the following ways:
Object name. Property name
Object name. Method name (parameter table)

String (String Object): Method

 

String Support for strings
String.charat () Returns the nth character in a string
String.charcodeat () Code that returns the nth character in a string
String.Concat () Connection string
String.fromCharCode () Create from character encoding-a string
String.IndexOf () Retrieving strings
String.LastIndexOf () Retrieving a string from backward forward
String.Length The length of the string
String.localecompare () Compare two strings in a local-specific order
String.match () Found a match for one or more regular expressions
String.Replace () Replace a substring that matches a regular expression
String.search () Retrieving substrings that match regular expressions
String.slice () Extract a substring
String.Split () Splitting a string into a string array
String.substr () Extract a substring
String.substring () Returns a substring of a string
String.tolocalelowercase () Convert string to lowercase
String.tolocaleuppercase () Convert a string to uppercase
String.tolowercase () Convert a string to lowercase
String.tostring () return string
String.touppercase () Convert a string to uppercase
String.valueof () return string

Math object: Method

  

Math.Abs () Calculate absolute Value
Math.acos () Calculating the inverse cosine value
Math.asin () Calculates the inverse sine value
Math.atan () Calculate the inverse tangent value
Math.atan2 () Calculates the angle from the x-axis to a point
Math.ceil () Rounding on a number
Math.Cos () Calculate cosine value
Math.e Arithmetic constant E
Math.exp () Calculate ex
Math.floor () Rounding on a number
Math.ln10 Arithmetic constant Loge10
Math.ln2 Arithmetic Constants Loge2
Math.log () Calculates the natural logarithm of a number
math.log10e Arithmetic Constants log10e
math.log2e Arithmetic Constants Log2e
Math.max () Returns the maximum parameter
Math.min () Returns the smallest parameter
Math.PI Arithmetic constant pi
Math.pow () Calculate XY
Math.random () Returns a pseudo-random number
Math.Round () Rounds to the nearest integer
Math.sin () Calculate the sine value
MATH.SQRT () Calculate square root
Math.sqrt1_2 Arithmetic constant 1/
Math.sqrt2 Arithmetic constants
Math.tan () Calculate Tangent values

Date Object: Method

Date objects that manipulate the date and time
Date.getdate () Returns one day in one months
Date.getday () Return one day of the week
Date.getfullyear () Returns the year field of a Date object
Date.gethours () Returns the hour field of a Date object
Date.getmilliseconds () Returns the millisecond field of a Date object
Date.getminutes () Returns the minute field of a Date object
Date.getmonth () Returns the month field of a Date object
Date.getseconds () Returns the second field of a Date object
Date.gettime () Returns the millisecond representation of a Date object
Date.gettimezoneoffset () Judging the time difference from GMT
Date.getutcdate () Return the day is one months of which day (world time)
Date.getutcday () Returns the day of the Week (World time)
Date.getutcfullyear () Return year (World time)
Date.getutchours () Returns the hour field of a Date object (world time)
Date.getutcmilliseconds () Returns the millisecond field of a Date object (world time)
Date.getutcminutes () Returns the minute field of a Date object (world time)
Date.getutcmonth () Returns the month of the Date object (World time)
Date.getutcseconds () Returns the second field of a Date object (world time)
Date.getyear () Returns the year field of a Date object (world time)
Date.parse () Parse Date/Time string
Date.setdate () Set a day for one months
Date.setfullyear () Set the year, or you can set the month and day
Date.sethours () Set the Hour field, minute field, second field, and millisecond field for a Date object
Date.setmilliseconds () Set the millisecond field of a Date object
Date.setminutes () Set the minute and second fields of a Date object
Date.setmonth () Set the month and day fields of a Date object
Date.setseconds () Set the second and millisecond fields of a Date object
Date.settime () Set Date object in milliseconds
Date.setutcdate () Set a day in one months (world time)
Date.setutcfullyear () Set year, month, and Day (world time)
Date.setutchours () Set the Hour field, minute field, second field, and millisecond field of a Date object (world time)
Date.setutcmilliseconds () Set the millisecond field of a Date object (world time)
Date.setutcminutes () Set the minute and second fields of a Date object (world time)
Date.setutcmonth () Set the month and day fields of a Date object (world time)
Date.setutcseconds () Set the second and millisecond fields of a Date object (world time)
Date.setyear () Set the Year field for a Date object
Date.todatestring () Returns a Date object as a string
Date.togmtstring () Convert date to World time string
Date.tolocaledatestring () Returns the date part of a Date object as a locally formatted string
Date.tolocalestring () Converts a date to a locally formatted string
Date.tolocaletimestring () Returns the time portion of a Date object as a locally formatted string
Date.tostring () Converts a date to a string
Date.totimestring () Returns a Date object as a string
Date.toutcstring () Convert Date to String (World time)
DATE.UTC () Converting the date specification to milliseconds
Date.valueof () Converts a date to a millisecond representation

Array object: Method

Array Internal support for arrays
Array.concat () Connection array
Array.join () Concatenate array elements to construct a string
Array.Length The size of the array
Array.pop () Delete and return the last element of the array
Array.push () Adding elements to an array
Array.reverse () Reverses the order of elements in an array
Array.shift () Move an element to an array
Array.slice () Returns part of an array
Array.Sort () Sorting an array element
Array.splice () Inserting, deleting, or replacing elements of an array
Array.tolocalestring () Convert an array to a local string
Array.tostring () Convert an array to a string
Array.unshift () Inserts an element in the head of an array

Event object: Method

A. Window events that are only valid in the body and frameset elements
When the onload page or picture loading is complete
OnUnload when the user leaves the page
B. Form element events that are valid in form elements
OnChange when the contents of the box change
onsubmit When you click the Submit button
OnReset when the mouse button is re-clicked
Onselect Text is selected
When the onblur element loses focus
onfocus when an element gets focus
C. keyboard events, which are not valid in the Base,bdo,br,frame,frameset,head,html,iframe,meta,param,script,style,title element
onkeydown When you press the keyboard key
onkeypress Press or hold the keyboard key
onkeyup When the keyboard button is released
D. Not valid in the Base,bdo,br,frame,frameset,head,html,iframe,meta,param,script,style,title element
When an onclick mouse clicks on an object
OnDblClick when the mouse double-clicks an object
OnMouseDown when the mouse is pressed
OnMouseMove when the mouse is moved
onmouseout when the mouse leaves the element
onmouseover when the mouse passes through an element
OnMouseUp When the mouse button is released

The built-in object of JS Foundation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.