Whats wrong with this code


Im not actually trying to do that exercise im just trying to work on a game using that exercise to do it and add functions to the game when I learn more (I.E a combat system, store, etc)

There is no error message but it always outputs “zombie”

console.log (‘player stats’)

//output player name
var player = ‘mark’;

//output player strength
var strength = '1’
console.log(‘strength’, strength)

//output player speed
var spd = '1’
console.log(‘speed’, spd)

//output player health
var HP = '10’
console.log (‘HP’, HP)

//choose next opponent
var chosenextopponent = (Math.floor (Math.random() *2));
if (nextopponent = 1) var nextopponent = (‘zombie’)
else if (nextopponent = 2) var nextopponent = (‘giant’)

//output next opponent
console.log (nextopponent)


Getting segued because something in a lesson catches your fancy is the worst possible way to learn. Hands down, it will get one nowhere.

This forum is not here to fill all the holes that you need to fill before embarking upon extra-curricular creativity. Use this time to focus on the learning track and do the exercises without deviating. That would be the best course of action at this time.

Return to this project when you are better able and don’t require as much technical direction. Creative direction is easier to give.


Okay, thank you ill do that


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.