Challenge - ES6: Use Destructuring Assignment to Assign Variables from Arrays - Added solution (#26531)
* added solution for challenge * removed function from seed and solution
This commit is contained in:
		| @@ -42,13 +42,11 @@ tests: | |||||||
| <div id='js-seed'> | <div id='js-seed'> | ||||||
|  |  | ||||||
| ```js | ```js | ||||||
|  | "use strict"; | ||||||
| let a = 8, b = 6; | let a = 8, b = 6; | ||||||
| (() => { | // change code below this line | ||||||
|   "use strict"; |  | ||||||
|   // change code below this line |  | ||||||
|  |  | ||||||
|   // change code above this line | // change code above this line | ||||||
| })(); |  | ||||||
| console.log(a); // should be 6 | console.log(a); // should be 6 | ||||||
| console.log(b); // should be 8 | console.log(b); // should be 8 | ||||||
| ``` | ``` | ||||||
| @@ -63,6 +61,12 @@ console.log(b); // should be 8 | |||||||
| <section id='solution'> | <section id='solution'> | ||||||
|  |  | ||||||
| ```js | ```js | ||||||
| // solution required | "use strict"; | ||||||
|  | let a = 8, b = 6; | ||||||
|  | // change code below this line | ||||||
|  | [a, b] = [b, a]; | ||||||
|  | // change code above this line | ||||||
|  | console.log(a); // should be 6 | ||||||
|  | console.log(b); // should be 8 | ||||||
| ``` | ``` | ||||||
| </section> | </section> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user