Error in rock papers scissor


can somebody tell me why am i getting “undefined” error???

The user choose: rock
Random no selected: 0
The computer choose: rock
tie
undefined

Hello, @ladshubham4, and welcome to the forums.

It’s not an error. It’s the value returned by your determineWinner function. Any function that doesn’t explicitly return a value implicitly returns undefined in JavaScript. If you don’t want to log the return value, don’t. Just call the function: determineWinner(userChoice, computerChoice); instead of console.log(determineWinner(userChoice, computerChoice));. console.log() has nothing to do with calling a function, it simply prints it’s argument to the console.

For future reference, please review How do I format code in my posts? It’s much easier for others to offer assistance with actual code than a screen shot.