You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 3, 2023. It is now read-only.
To me, it seems that the play function in this challenge is not correctly checking the value of game.currentRoom.
Here is the play function:
function play(method) {
if (!game.currentRoom && !game.currentRoom.name) {
throw new Error(
`It looks like the game isn't quite right! Make sure your \`${method}\` method is correct`
);
}
console.log(`You are in the ${game.currentRoom.name}.\n`);
rl.question(
"Which direction would you like to move? (north/east/south/west) ",
function (direction) {
game.move(direction);
console.log("\n---------------------\n");
play("move");
}
);
}
If the game.start() method fails to set game.currentRoom and game.currentRoom remains as null, the following is logged to the console:
TypeError: Cannot read property 'name' of null
Should it not be expected to see the following logged to the console?:
`It looks like the game isn't quite right! Make sure your `start` method is correct`
To me, it seems that the
playfunction in this challenge is not correctly checking the value ofgame.currentRoom.Here is the play function:
If the
game.start()method fails to setgame.currentRoomandgame.currentRoomremains asnull, the following is logged to the console:TypeError: Cannot read property 'name' of nullShould it not be expected to see the following logged to the console?:
`It looks like the game isn't quite right! Make sure your `start` method is correct`