# Why this shortcut didn't work?

**URL:** <https://forum.freecodecamp.org/t/why-this-shortcut-didnt-work/443047>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [January 28, 2021, 2:31am UTC](https://forum.freecodecamp.org/t/why-this-shortcut-didnt-work/443047 "2021-01-28T02:31:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Placide](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/placide/32/184066_2.png) [@Placide](https://forum.freecodecamp.org/u/Placide)\
**Post date:** [January 28, 2021, 2:31am UTC](https://forum.freecodecamp.org/t/why-this-shortcut-didnt-work/443047/1 "2021-01-28T02:31:21Z")

</div>

**Tell us what’s happening:**

**Your code so far**

```js

const s = [5, 7, 2];
function editInPlace() {
// Only change code below this line

// Using s = [2, 5, 7] would be invalid
 s[5, 7, 2] = [2, 5, 7];
// Only change code above this line
}
editInPlace();

```

**Your browser information:**

User Agent is: `Mozilla/5.0 (X11; CrOS x86_64 13505.100.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.142 Safari/537.36`.

**Challenge:** Mutate an Array Declared with const

**Link to the challenge:**

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [January 28, 2021, 2:51am UTC](https://forum.freecodecamp.org/t/why-this-shortcut-didnt-work/443047/2 "2021-01-28T02:51:45Z")

</div>

That syntax is not valid, but if it was, the only way to interpret it is that you want to replace the data at indices 5, 7, and 2 of your array, which isn’t what you want.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [July 29, 2021, 2:52pm UTC](https://forum.freecodecamp.org/t/why-this-shortcut-didnt-work/443047/3 "2021-07-29T14:52:01Z")

</div>

Closed on July 29, 2021, 2:52pm UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
