Help - eval giving me Undefined error

Asked Dec 1, 2020·1 reply·Last activity 5 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Gosh, $(touser) $(eval const responses = [' is a dumb, stupid, idiot!', ' is the WORST!', ' stinks, stinks REAL bad!'])

1 reply

Hey @Cozy Shark!

I mean, you don't even pick a response from your list... The error you get is because you use wrong quotation marks tho': instead of ', " or better yet `` ```.
Here's a fix:

$(eval r=[`is a dumb, stupid, idiot`,`is the WORST`,`stinks, stinks REAL bad`]; `Gosh, $(touser) ${r[Math.floor(Math.random()*r.length)]}!`)