As a recent addition to this community and as someone who just started learning JavaScript 4 weeks ago, I have progressed from html to css and now onto JavaScript.
My current project involves creating an array-based rock-paper-scissors game with minimal mathematical operations. Please excuse the potential messiness in my code.
I am facing difficulties in getting any output in the console log. Can anyone review this code and provide feedback?
var rPs = ["Rock", "Paper", "Scissors"]
var random = rPs[Math.floor(Math.random() * 3)];
function random(you, computer){
if (you===computer){
console.log("It's a tie!");
} else if (you==="Rock"&&computer==="Scissors"||you==="Paper"&&computer==="Rock"||you==="Scissors"&&computer==="Paper") {
console.log("You've won!");
} else {
console.log("You've lost!");
}
};