Can anyone help me please(a rock paper scissor project)

alert('This is a rock paper scissor game');

let answer =prompt('input');

let number00 =Math.floor(Math.random()*3);

let thing =function(number00){
    if (number00=0) {
        thing= 'rock'
    }else if (number00=1){
        thing='paper'
    }else if (number00=2) {
        thing='scissor'
    } 
};
if (((answer='rock')&&(thing ='scissor'))||((answer='scissor')&&(thing ='paper'))||((answer='paper')&&(thing ='rock'))) {
    document.getElementById('win').innerHTML='win'
}else if (((answer='scissor')&&(thing ='rock'))||((answer='paper')&&(thing ='scissor'))||((answer='rock')&&(thing ='paper'))) {
    document.getElementById('lose').innerHTML='lose'
}else if (((answer='rock')&&(thing ='rock'))||((answer='scissor')&&(thing ='scissor'))||((answer='paper')&&(thing ='paper'))) {
    document.getElementById('tie').innerHTML='tie'    
}else()=>console.log('?')

What is the error returned in your code?
If you mention it I may be able to help.

1 Like

I don’t know exactly what the problem is but looking at your code, you are using the wrong comparison operator here.

And also, you are re-assigning value to variable thing which is wrong.

1 Like

It only returned “win” even I type something wrong

Use the === operator for the if statement checks.

1 Like

The variable thing is a function. You have to call it to get the value it will return. You also need to return the value in the function, not reassign it to thing.

1 Like

thanks~~~~~~~~~~~~~~~~~~~~ :innocent: