Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of a single statement in ES6

Shulou Source: shulou.com Published: 2022-06-01 04:09:08 10月03日 Update

Editor to share with you the example analysis of a single ES6 sentence, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Single statement

In the age of ES6, statements for manipulating arrays will be more compact.

/ / find the maximum value in the array const max = (arr) = > Math.max (.arr); max ([123,321,32]) / / outputs: 321max / calculate the sum of the array const sum = (arr) = > arr.reduce ((a, b) = > (a + b), 0) sum ([1,2,3,4]) / / output: 10 is all the contents of the article "sample Analysis of ES6 single sentence". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Sentences arrays articles examples analysis content maximum compact not so much most sum times more maximum knowledge industry information information channels channels references Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info OPPO Reno NVidia Linux Docker