JS Array, String, Json,bind, Name

Source: Internet
Author: User

/** * Created by W.j.chang on 2014/5/23. *///is the method Console.log (Array.isarray (new array)) to interpret the array, Console.log (Array.isarray ([])), var arr = [1,2,3];// Traversal method Arr.foreach (function (v) {console.log (v);}); Console.log ("---------------------");//filter but do not change the original array arr.filter (function (v) {return v < 3;}). ForEach (function (v) {console.log (v);}); Arr.foreach (function (v) {console.log (v);}); Console.log ("---------------------");//Changes but does not change the original array arr.map (function (v) {return v * 3;}). ForEach (function (v) {console.log (v);}); Arr.foreach (function (v) {console.log (v);}); Console.log ("---------------------"); [1,2,3].map (function (v) {return v*2}). ForEach (function (v) {console.log (v);}); /String Console.log ("Hello". Trim ());//JSON processing var obj = Json.parse (' {"A": "B", "C": "D"} '); Console.log (OBJ.A); Console.log ( Json.stringify (obj));//bind changes the reference function a () {This.hello = = "World";} var B = a.bind ({hello: ' world '});//name function name var AA = function Woot () {};console.log (aa.name);

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.