From 23096f7ed625b78409d6f0f798c9579521adfa14 Mon Sep 17 00:00:00 2001 From: Alan Price <23743415+alanpaulprice@users.noreply.github.com> Date: Thu, 24 Jan 2019 19:24:27 +0000 Subject: [PATCH] Challenge - ES6: Use Destructuring Assignment to Assign Variables from Arrays - Added solution (#26531) * added solution for challenge * removed function from seed and solution --- ...nt-to-assign-variables-from-arrays.english.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.english.md index 15077042c4..7072f70c5b 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.english.md @@ -42,13 +42,11 @@ tests:
```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
```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 ```