So, I started with this. I think, Worker is my class
function Worker(firstName, lastName, role, action) {
this.firstName = firstName;
this.lastName = lastName;
this.role = role;
this.action = action;
Worker.random = function (name) {
name = this.name
let actions = this.action
console.log(Math.floor((Math.random() * name.action)))
}
}
Now I'm trying to make a 'new' object out of it here,
let Stanley = new Worker('Stanley', 'Hudson', 'Sales', [
'Did I Stutter?? You and Michael drink 3.',
'You just had a heart attack and every time Michael opens his mouth you\'re stress levels to up. Drink 4 to calm your nerves',
'Your cheating has caught up with you. Bad Stanley. Drink 2'
])
How do I make it so that I can Stanley.random() and get back a random action from the action array? I want to be able to use the random() function on any of the characters. I just don't really know how to go about it? This is the point right? to be able to use the methods over and over again?
I know I'm dumb, if you'd like to tell me that, feel free, just know that I know. Any help, is very appreciated