Write a JavaScript program that allows the user to play Rock Paper Scissors.
The Program should ask the user if they want to choose rock, paper or scissors. A computer should be randomly assigned one of the three choices.
Winning combinations are as follows:
Rock beats Scissors
Scissors beats Paper
Paper beats Rock.
The program should indicate who the winner was. This program should be written in vanilla javascript (No libraries).
The code can either be
A: intended for the browser, in which case an index.html file should be included which includes a script src to the program.
B: intended for node, in which case the code should be able to be run by typing node (your_file).js in the terminal, and the program will run inside the terminal.
The program should also handle the following issues:
The player choosing an invalid option.
Handling a tie (rethrow)