I'm very new to JavaScript.
So I'm trying to create a discord bot. I want to randomly choose a value from an array and then display it, but I want some elements to be more likely to be chosen than others. I'm attempting to do this with percentages.
This is everything I have done so far:
var locations = ['cave', 'house', 'bin', 'haroon`s mansion'];
var chance = [30, 30, 35, 5];
var randomValue = Math.random() * 100;
Now, how do I make it choose one and send it back? Please could you explain what each command does?