Solution mutate-an-array-declared-with-const.english.md (#18759)
* Update mutate-an-array-declared-with-const.english.md * Improved JavaScript style
This commit is contained in:
committed by
Todd Chaffee
parent
1e3804889e
commit
b13e23037c
@ -44,7 +44,7 @@ tests:
|
|||||||
```js
|
```js
|
||||||
const s = [5, 7, 2];
|
const s = [5, 7, 2];
|
||||||
function editInPlace() {
|
function editInPlace() {
|
||||||
"use strict";
|
'use strict';
|
||||||
// change code below this line
|
// change code below this line
|
||||||
|
|
||||||
// s = [2, 5, 7]; <- this is invalid
|
// s = [2, 5, 7]; <- this is invalid
|
||||||
@ -64,6 +64,17 @@ editInPlace();
|
|||||||
<section id='solution'>
|
<section id='solution'>
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// solution required
|
const s = [5, 7, 2];
|
||||||
|
function editInPlace() {
|
||||||
|
'use strict';
|
||||||
|
// change code below this line
|
||||||
|
|
||||||
|
// s = [2, 5, 7]; <- this is invalid
|
||||||
|
s[0] = 2;
|
||||||
|
s[1] = 5;
|
||||||
|
s[2] = 7;
|
||||||
|
// change code above this line
|
||||||
|
}
|
||||||
|
editInPlace();
|
||||||
```
|
```
|
||||||
</section>
|
</section>
|
||||||
|
Reference in New Issue
Block a user