JavaScript, array, and function pass-through notes

Source: Internet
Author: User

function return value return a function with only one return value

function parameter variable parameter, indefinite parameter arguments

extract the inline styles style

Extract non-inline style currentstyle incompatible getcomputedstyle can be used in incompatible browsers when writing a program can use the IF function to handle compatibility issues

When extracting non-inline styles, composite styles (such as: Border,backgrund) are not extracted, and a single style (height,width) can be extracted

Use of arrays

Define VAR arr=[12,5,8,9]

var arr=new Array (12,5,8,9)

There is no difference between the two definitions, "" The performance is slightly higher, the code is relatively short

Properties of the array

Only one length can be obtained and can be set

the use principle of arrays : There should be only one type of variable in the array

Ways to manipulate arrays

Push adds a value to the end of the array

Pop minus tail one value

Shift subtracts a value from the head

Unshift adds a value to the head

Splice (starting point, length) can be deleted from among

Splice (start, length, Element) can replace elements from among

Links to concat arrays

Join joins the array inside the array with the specified symbol

Sort plus an If function reture (N1-N2)

Well, today to start the timer, will soon start the Carousel map, the road is far away, do not forget beginner's mind! Come on.

JavaScript, array, and function pass-through notes

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.