JS Basic Knowledge Memory Part (Consolidation Foundation dedicated)

Source: Internet
Author: User

Frequently used: light blue words are optional parameters

0=false;1=true

0?1:2: True returns the first value, FALSE returns a second value

True&&false: The first value of the logical operator

typeof (Object,string ...): Identifying types in parentheses

if () {}else{}:if statement

for (Var i=0;i<x;i++) {}:for loop

Math.ceil (number) rounding up

. Floor (x) rounding down

. Round () rounding

. ABS () absolute value

. Max () 丨. Min () takes the maximum or minimum value.

parseint (String,radix) directly takes an integer to ignore the number after the decimal point

Parsefloat (String) does not ignore the number after the decimal point, but after ignoring the number of letters

Number () If the letter appears, the entire error is not recognized.

Num.tofixed (digits) digits parameters are reserved for several digits.

Usually use IndexOf

Str.search (regexp) returns the position of the result, no then returns-1

. indexof (Searchvalue,formindex) The first parameter to find the value, the second value from which to start looking for the value, no return-1

The. Match (RegExp) does not return null.

. replace (regexp| string,newstring) Replace the first argument with a regular expression or a string, and the second as a new string

. Slice (Beginnumber,endnumber) The first value is the start value and the second is the end value that returns the beginning to the end of the value, which can be inverted-1 for the last

. substr (Start,radix) slightly

The. Split () search parameter is a split symbol, which searches for the symbol in the parameter as a delimiter, and returns the individual strings separated by the result using separators

. toLowerCase () 丨 tolouppercase () conversion case

  

JS Basic Knowledge Memory Part (Consolidation Foundation dedicated)

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.