A detailed description of JavaScript common functions

Source: Internet
Author: User

1,splice (). Arrayobject.splice (index,howmany,item1,....., ItemX)

The parameter index is required. An integer that specifies the location of the Add/remove item, using a negative number to specify the position from the end of the array.

Howmany required. The number of items to delete. If set to 0, the item is not deleted.

Item1, ..., ItemX Optional. Adds a new item to the array.

The return value returns the processed array.

Note All major browsers support the splice () method.

<script type= "Text/javascript" >var arr = new Array (6) arr[0] = "George" arr[1] = "John" arr[2] = "Thomas" arr[3] = "Jame S "arr[4] =" Adrew "arr[5] =" Martin "
document.write (arr + "<br/>")
arr.splice(2,3,"William")
arr.splice(2,0,"William")
</script>

A detailed description of JavaScript common functions

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.