JS Fourth Day Study summary

Source: Internet
Author: User

1, assignment value, reference pass value

2 various objects (built-in objects and custom objects)

3.string objects:

Property Method
Stringobj.length Get length Stringobj.charat (Index)

Returns a character that specifies the subscript

  stringobj.indexof (substr)

< Span style= "font-family: Arial" > find character string first present position

Stringobj.lastindexof (SUBSTR)

Find where the string last appears

String.substr (Startindex[,length]) intercepts substrings from the original string

Stringobject.substring (Startindex[,endindex]) intercepts substrings from the original string

Stringobject.split (Sep) splits a string into an array

Stringobject.localecompare (target) compares the order of two strings

Stringobject.replace (the regular expression , the character to be replaced ) replaces one string with another character string

4.Array Objects

Property Method

arrayobject.length

< Span style= "FONT-SIZE:12PX; Color: #888888 "> Get the length of the array

 

arrayobject.shift ()

< Span style= "FONT-SIZE:12PX; Color: #888888 "> Delete the first element in the array and return it

 

 

arrayobject.unshift ( element 1, element 2)

add one or more array elements to the beginning of the array

 

 

arrayobject.pop ()

Delete the last element of the array and return it to

 

 

arrayobject.push ()

add one or more array elements to the end of the array and return the new length to

 

 

arrayobject.join ([Sep])

merging an array into a string

 

 

arrayobject.reverse ()

Flips the array

 

Arrayobject.sort (SortBy)

Sorting an array element

5. Date Object

method name

function

Dateobject.getfullyear ()

get 4

Dateobject.getmonth ()

get month

The return value is Span style= "Font-family:calibri" >0 (January) to 11

Dateobject.getdate ()

get one day in one months

The return value is Span style= An integer between "Font-family:calibri" >1 ~

Dateobject.gethours ()

return 0~23 hour

dateobject.  getminutes ()

return 0~59 minute

Dateobject.getseconds

Returns the number of seconds 0~59

dateobject. &NBSP; getmilliseconds ()

return milliseconds  0~999

Dateobject.getday ()

return one day of the week  

return value: 0~6

Dateobject.gettime ()

return timestamp   from 1970 year 1 month 1 # 0 0 sub 0 seconds start to present in milliseconds

Find where the string last appears

JS Fourth Day Study summary

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.