--- id: 5dbba89e6ef5fe3a704f8499 title: Part 131 challengeType: 0 dashedName: part-131 --- # --description-- Use the `+=` operator to add "Your \[last item in inventory array] breaks." to the end of `text.innerText`. Instead of the bracketed text, it should show the actual item name. Use `inventory.pop()` to both remove the last element from the array AND return that element. For example: ```js let shoppingList = ["milk", "apples", "cereal"]; console.log("I bought " + shoppingList.pop() + "."); // Logs "I bought cereal." // shoppingList now equals ["milk", "apples"] ``` # --hints-- See description above for instructions. ```js assert( attack .toString() .replace(/\s/g, '') .match( /if\(Math\.random\(\)\<\=0?\.1\)\{text\.innerText\+\=\"Your\"\+inventory\.pop\(\)\+\"breaks\.\"\;?\}/ ) || attack .toString() .replace(/\s/g, '') .match( /if\(Math\.random\(\)\<\=0?\.1\)\{text\.innerText\+\=\"Your\"\.concat\(inventory\.pop\(\)\,\"breaks\.\"\)\;?\}/ ) ); ``` # --seed-- ## --before-user-code-- ```html RPG - Dragon Repeller
XP: 0 Health: 100 Gold: 50
Monster Name: Health:
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
``` ## --after-user-code-- ```html ``` ## --seed-contents-- ```html ``` # --solutions-- ```html ```