From 7316e800bafa3a0cbb41a0f92644db9d112b5bd6 Mon Sep 17 00:00:00 2001 From: Tobias Sirianni Melo <92902666+tsirianni@users.noreply.github.com> Date: Mon, 22 Jan 2024 21:07:55 -0300 Subject: [PATCH] fix(curriculum): adds code examples for shift method for RPG Game (#53325) --- .../62a8d539dc11cb42b5dd7ec8.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d539dc11cb42b5dd7ec8.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d539dc11cb42b5dd7ec8.md index 443c965d520..38331625e0e 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d539dc11cb42b5dd7ec8.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d539dc11cb42b5dd7ec8.md @@ -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--