Exercism-JS/elyses-enchantments/HINTS.md
2022-05-05 13:21:53 -05:00

2.1 KiB

Hints

1. Retrieve a card from a stack

  • Array indices start at 0.
  • This page has more information on how to access array elements.

2. Exchange a card in the stack

  • The array is a mutable structure, you can change its content anytime.
  • You can find an example here, inside the 'Changing an Array Element' section.

3. Insert a card at the top of the stack

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

4. Remove a card from the stack

  • There is a built-in method that, among other use cases, can be used to remove elements starting at a certain position.

5. Remove the top card from the stack

  • There is a built-in method to remove the last element from the array.

6. Insert a card at the bottom of the stack

  • There is a built-in method to add a new value to the beginning of the array.

7. Remove a card from the bottom of the stack

  • There is a built-in method to remove the first element from the array.

8. Check the size of the stack

  • Arrays have a property to retrieve their length.