Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Documentation Request - Javascript

Team,

Where can I find documentation regarding the left side of the equation of the below JavaScript Code:

var [a, b, c] = "10-11-12".split('-');

Result:
a = 10
b = 11
c = 12
// Note: this is used in Google Apps Script

Apps Script UI Example

Thanks!

like image 859
propjk007 Avatar asked Dec 20 '22 13:12

propjk007


2 Answers

This is called destructuring assignment

NOTE it's only available if your runtime is >= JavaScript 1.7

like image 191
maček Avatar answered Jan 03 '23 09:01

maček


Mozilla Developer Network has some great documentation on the split method: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/split

like image 28
Tim Ferrell Avatar answered Jan 03 '23 09:01

Tim Ferrell