Array, ecercises javascript

Hello Everybody , I’m with a little difficult with this exercise, number one is a question e number two is my answer, if someone can help with this question i would appreciate, bacause i dont understand why its not working.

1- Make a card appear by inserting a new card at the top of the stack. Return the adjusted stack.

const newCard = 8;
insertItemAtTop([5, 9, 7, 1], newCard);
// => [5, 9, 7, 1, 8]

tip: * There is a built-in method to add a new value to the end of the array.

2-
/**

  • Inserts a new card on top of the pile.
  • @param {number[]} cards - The stack of cards.
  • @param {number} newCard - The new card to be inserted.
  • @returns {number[]} The stack of cards with the new card applied.
    */

export function insertItemAtTop(cards, newCard) {

// Copies the original matrix to avoid lateral changes.
const alteredStack = […cards];
// Inserts the new card on top of the stack using the unshift method.
alteredStack.unshift(newCard);
// Returns the adjusted card pile.
return alteredStack;
}

this is error : const stack = [1];
const newCard = 5;
const expected = [1, 5];
expect(insertItemAtTop(stack, newCard)).toStrictEqual(expected);
TEST FAILURE
Error: expect(received).toStrictEqual(expected) // deep equality

  • Expected - 1
  • Received + 1

    Array [

  • 1,
    5,
  • 1,
    ]

You can use a codeblock to make the code and error legible:
```
YOUR TEXT HERE
```

When I fix the formatting of your code and paste it into node, I get this:

> const newCard = 8;
> insertItemAtTop([5, 9, 7, 1], newCard);
[ 8, 5, 9, 7, 1 ]

That doesn’t seem to align with the requirement docs.