+ 1

Anyone could help to explain below code? Thanks!

let [learn, solo = "solo"]="learn"; [solo, learn] = [learn, solo]; console.log(solo + learn) // output: le

9th Oct 2018, 4:08 PM
Anastasia Chuan
Anastasia Chuan - avatar
2 Antworten
+ 3
string behaves like array line 1 => [learn = undefined, solo = "solo"] => [learn = "l", solo = "e"] line 2 => [solo = "l", learn = "e"] => console.log
9th Oct 2018, 5:04 PM
Naty
+ 1
Naty Thank you!☺
9th Oct 2018, 5:20 PM
Anastasia Chuan
Anastasia Chuan - avatar