4 ms·
function isEvenNumber(num) { if(Math.random() > 0.5) { return true } return false } Took a while, but worked in the end. Be careful with th
by btdmaster 5y ago
function isEvenNumber(num) {
if(Math.random() > 0.5) {
return true
}
return false
}
Took a while, but worked in the end. Be careful with the arbitrary code execution because I'm sure people can do more than generate random numbers!
- yehoshuapw 5y agoIt's running in the browser. (I checked with an "alert") so its not that bad. Edit: nvm, it seems (according to a comment here by the author) that it is sent to the server and verified. Edit 2: indeed, once the answer worked locally, it got sent - and got stuck at "Submitting..." (locally, I clicked the alert)
- mellavora 5y agoor, as Randall Munroe put it, https://xkcd.com/1185/ https://xkcd.com/1185/ where 'panic sort' remains my favorite
- dylan604 5y agohttps://xkcd.com/810/ https://xkcd.com/810/ seems apropros as well
- tempodox 5y agoToo circuitous, too procedural. Just, return (Math.random() > 0.5);
- maxk42 5y agoYou don't need the parentheses either.