I want to simplify this nested if/else conditionals or statements, but I don't know-how because I want them easier to read and more practical. I'm just a freshman at programming. That's why I get stuck with this spaghetti code.
setmessage = 'You have requested that the file type of the site screenshot be:'
normalized = message.content.toLowerCase();
npng, npdf = normalized.substring(0, 3);
nhtml = normalized.substring(0, 4);
if (npng == 'png') {
message.channel.send(setmessage + '**PNG**');
areyousure();
} else if (npdf == 'pdf') {
message.channel.send(setmessage + '**PDF**');
areyousure();
} else if (nhtml == 'html') {
message.channel.send(setmessage + '**HTML**');
areyousure();
} else {
message.channel.send(invalidmessage);
getouttahere();
}
npng, npdf = normalized.substring(0, 3);looks bad. ;)console.log('npng', npng);