💡 What will be the output of the following code?
const stack = [];
const addToStack = (n) => stack.push(n);
cy.wrap([addToStack]).invoke(0, 4).then(() => console.log(stack));
A | [0, 4]
B | [4]
C | [4, 4]
D | Error, invoke is not a function
E | Error, 0 is not a function
🎉 Quiz Completed! 🎉
The
.invoke() method behaves differently when you chain it with other commands.
So, in this case, it will invoke
addToStack(4)
and push
4
to the
stack
array twice.