JS Learning Phase Summary

Source: Internet
Author: User
Tags prev

typeof operator: Returns a string that may be "undefined", "Boolean", "string", "number", "Object", and "function", so the array cannot be judged.

Nan (not a number): Use Nan (val) to return False if Val can be converted to one count, otherwise true.

parseint (Val,way) where the way can be 2,4 ... is to convert by this binary, return number type, num.tostring (way), but return string type.

The object type has a hasOwnProperty (name) to determine whether the current object is in an instance or in a prototype.

Each function has a arguments Property object to record its arguments, which is equivalent to an array of parameters, which can be recursive with Argumentscallee.

The Unshift method pushes two elements from the front-end to the array and returns the length, using unshift and pop to simulate the queue in reverse.

Sort (Compare), where the Compare (Val1,val2) method returns after Val1 in front of the val2-1, and 0 appears to be unchanged.

An array operation is done with the splice function, splice (A1,A2,A3 ... A1,A2 required A1 represents the starting position, A2 represents the number of items to be deleted, and the following parameters represent the new values to be inserted from that location.

IndexOf returns a Val position in the array, lastindexOf () starts at the back of the number.

Array iteration method: every () each value returns true to return True,filter () returns all arrays that return true elements, and ForEach () just runs the function, does not return, map () returns an array of function call results, Some () is relative to every, and returns true if there is a return ture.

Example: var everyres = number.every (function (item,index,array) {return item>2;});//item,index,array three parameters are required.

Merging of arrays: Reduce and reduceright (), for example: var sum = values.reduce (function (prev,cur,index,array) {return prev+cur;});p rev for the previous one, Cur represents the latter one.

Date type: var date = new Date (Date.parse ("may 25,2004")); var date = new Date (DATE.UTC (2015,4,5,17,55,50));

Call and apply differences the first is this (last afternoon object).

var obj =eval ("(" +data+ ")") to convert the JSON

JS Learning Phase 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.