Get the App
SLTechnology News&Howtos  ›  Development  › 

How to transfer class array to array in ES6

Shulou Source: shulou.com Published: 2022-06-01 04:39:30 09月22日 Update

This article is about how to convert class arrays to arrays in ES6. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Conversion method

ES6 has a few more ways to convert an array of classes into an array.

Use the extension operator

Function func () {console.log ([... arguments])} func ('Google',' facebook', 'Microsoft'); / / [' Google', 'facebook',' Microsoft']

Use Array.from

Function func () {console.log (Array.from (arguments))} func ('Google',' facebook', 'Microsoft'); / / [' Google', 'facebook',' Microsoft'] Thank you for reading! This is the end of the article on "how to transfer a class array to an array in ES6". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Tags: Array content method more article good practical article see knowledge operator reference help related operation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info OPPO Reno MariaDB NVidia Docker