educative.io

Test fails in Spread Operator Exercise when operator on RHS

The rest operator in JavaScript, as far as I know, can be used on either the left-hand-side or the right-hand-side of the assignment operator. But the test case only allows it to be used on the left hand side and the test fails if operator is used on the right hand side.

Test fails:

Test passes:

Hi @hallucinogenizer

The test case only allows it to be used on the left-hand side of the assignment operator because test cases are set according to the left-hand side, which is only for implementation purposes. You can either set the test cases for the right-hand side too.

Hope it will help, Happy Learning :slight_smile: