Solution mutate-an-array-declared-with-const.english.md (#18759)
* Update mutate-an-array-declared-with-const.english.md * Improved JavaScript stylepull/19354/merge
parent
1e3804889e
commit
b13e23037c
|
@ -44,7 +44,7 @@ tests:
|
|||
```js
|
||||
const s = [5, 7, 2];
|
||||
function editInPlace() {
|
||||
"use strict";
|
||||
'use strict';
|
||||
// change code below this line
|
||||
|
||||
// s = [2, 5, 7]; <- this is invalid
|
||||
|
@ -64,6 +64,17 @@ editInPlace();
|
|||
<section id='solution'>
|
||||
|
||||
```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>
|
||||
|
|
Loading…
Reference in New Issue