JS = a new JS function notation found today

Source: Internet
Author: User

Today in the online tour to a notation, return the number of letters in the string

var arr= ' AAABBCCAA '; var info = arr.split ("). reduce (p, k) = (p[k]++ | | (P[k] = 1), p), {}); Console.log (info) ;

Get: Object {a:5, b:2, C:2}

Reduce I found it is es5 new Add the array function, here do not elaborate, interested in their own search;

The key is ' = ', is the first time I saw in JS, in the online search did not find any information, I understand it, I hope the great God.

Should be an anonymous function, similar to () = (), this, before () for the input, after () for the output;


var kk= (A, a, b) = (A +); KK (2,6);

After execution, get 8;

Can also be written as:

var k=a=>Alert (a); K (0);

Alert Popup 0;

Is there a great God to tell me more about this and what is it?

JS = a new JS function notation found today

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.