{
const opinion = ["love", "hate"]
const feeling = [
{"type": "love", "feeling": "excited"},
{"type": "love", "feeling": "happy"},
{"type": "love", "feeling": "powerful"},
{"type": "hate", "feeling": "frustrated"},
{"type": "hate", "feeling": "bored"},
{"type": "hate", "feeling": "annoyed"}
]
function get_rand_int (min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function choose_feeling (op, feelings) {
if (op === "love") {
return(feeling.filter(obj => {return obj.type === "love"}))[get_rand_int(0, 2)].feeling
} else {
return(feeling.filter(obj => {return obj.type === "hate"}))[get_rand_int(0, 2)].feeling
}
}
function gen_sentence (opinion, feeling) {
const op = opinion[get_rand_int(0, 1)]
const feel = choose_feeling(op, feeling)
return("I " + op + " Javascript! It makes me feel " + feel + "!")
}
return(gen_sentence(opinion, feeling))
}