Build Rock paper scissors, not clear on the exact way the else/if's are working


so this is my code, i know right now that it's wrong, the error message i'm getting is "
Your code returned 'paper wins' instead of 'undefined' when the inputs are scissors and paper
i'm a beginner coder, i really only started about 4 days ago, and this is the first time i've been genuinely confused and not knowing even what question to ask. but i guess that i'm asking if someone can help me understand how this should be formatted, and perhaps a better explanation of the if statements inside if statements

    var computerChoice = Math.random();
if (computerChoice < 0.34) {
    computerChoice = "rock";
} else if(computerChoice <= 0.67) {
    computerChoice = "paper";
} else {
    computerChoice = "scissors";
} console.log("Computer: " + computerChoice);

var compare = function(choice1, choice2) {
    if (choice1 === choice2) {
        return "The result is a tie!";
    else if (choice1 === "scissors"){
        if (choice2 === "rock"){
                return "rock wins";
        else {
                return "paper wins";
    if (choice2 === "rock"){
        return "rock wins"
    if (choice2 === "paper")
        return "scisscors wins"


Hi first the if (choice === "rock") should be else if (choice1 === "paper") and the rest should like the one on top so it should be like that.

else if (choice1 === "paper"){
if (choice2 === "rock")
    return " paper wins"
else {
    return "scissors wins"