alexa
Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry

If-else statements for rock, paper, scissors game isn't returning the result that's supposed to return in js ?

If-else statements for rock, paper, scissors game isn't returning the result that's supposed to return in js ?

You are calling the random function twice instead of using the same cached value.

 console.log(computerPlay());
let computerSelect = computerPlay(); 

The results should match if you only invoke the function once and store the value.

 const computerSelect = computerPlay();
console.log(computerSelect);

255 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online