Can anyone help me understand why do we use empty string inside this function?

function playGame(playerMove){

    const computerMove = pickComputerMove();

    let result = '';

      if (playerMove === 'Scissors'){

          if(computerMove === 'Rock'){
          result = ('You Lose');

        } else if(computerMove === 'Paper'){
          result = ('You Win');

        } else if (computerMove === 'Scissors'){
          result = ('Tie');


in this case it doesn’t seem necessary, you are right.

Can you give the link of where this code comes from?

It depends on what you are doing with result. From the snippet we see, the variable should be declared before the if statements, otherwise you need to declare the variable within each if statement which is frowned upon. Now, the variable could be set as an empty string, but you could also declare it as null or leave off the =‘’ altogether leaving the variable declared but undefined. Or you could set it to a default statement ‘Tie’ and not worry about checking for ties.