Elyses enchantments: task 3

Hey all, I am wondering if anyone is able to help me with task 3 of Elyses enchantments. It asks for a function to remove a specific card from a stack, and I am struggling to find how to remove an item from an array. Could anyone help?

Which programming language is this?
Can you post what you tried and the error message you got?

This is javascript again.

I tried:

export function removeItem(cards, position) {
let wantedpart1 = cards.splice(0, position);
let wantedpart2 = cards[(position + 1)];
let fullWant = wantedpart1.concat(wantedpart2);
cards = fullWant;
return cards;

The error message:

Error: expect(received).toStrictEqual(expected) // deep equality


const stack = [1, 2, 3, 4];
const position = 0;
const expected = [2, 3, 4];
if (stack[0] === undefined) {
// eslint-disable-next-line no-undef
new Error(
‘The card has disappeared, but the stack has not changed in size. This magic trick has turned into actual magic. Perhaps a different method of removing the card will result in a stack that Elyse can work with…’,
expect(removeItem(stack, position)).toStrictEqual(expected);

Don’t worry, I’ve got it