Get the App
SLTechnology News&Howtos  ›  Development  › 

How ES6 returns multiple values from a function

Shulou Source: shulou.com Published: 2022-06-01 04:39:49 11月03日 Update

This article is about how ES6 returns multiple values from functions. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

Returns multiple values from a function

//Returns an array function example(){ return [1, 2, 4];}let [a, b, c] = example() //Returns an object function example(){ return { foo:1, bar: 2 }}let {foo, bar} = example(); or ( {foo, bar} = example() ) Thank you for reading! About "ES6 how to return multiple values from the function" This article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!

Tags: Functions multiple content more articles good practical objects arrays articles look knowledge reference help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Xiaomi Linux Microsoft OPPO Reno