fix(curriculum): adds code examples for shift method for RPG Game (#53325)

This commit is contained in:
Tobias Sirianni Melo
2024-01-22 21:07:55 -03:00
committed by GitHub
parent e25cc57b75
commit 7316e800ba

View File

@@ -7,7 +7,14 @@ dashedName: step-104
# --description--
The `shift()` method on an array removes the first element in the array and returns it. Use this method to take the first element from the `inventory` array and assign it to your `currentWeapon` variable.
The `shift()` method on an array removes the first element in the array and returns it.
```js
const numbers = [1, 2, 3];
const firstNumber = numbers.shift(); // returns 1
```
Use the `shift()` method to take the first element from the `inventory` array and assign it to your `currentWeapon` variable.
# --hints--