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'>
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
"use strict";
 | 
			
		||||
let a = 8, b = 6;
 | 
			
		||||
(() => {
 | 
			
		||||
  "use strict";
 | 
			
		||||
  // change code below this line
 | 
			
		||||
// change code below this line
 | 
			
		||||
 | 
			
		||||
  // change code above this line
 | 
			
		||||
})();
 | 
			
		||||
// change code above this line
 | 
			
		||||
console.log(a); // should be 6
 | 
			
		||||
console.log(b); // should be 8
 | 
			
		||||
```
 | 
			
		||||
@@ -63,6 +61,12 @@ console.log(b); // should be 8
 | 
			
		||||
<section id='solution'>
 | 
			
		||||
 | 
			
		||||
```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>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user