Skip to main content
Keen's user avatar
Keen's user avatar
Keen's user avatar
Keen
  • Member for 10 years, 7 months
  • Last seen more than a month ago
comment
revised
Return the flipped version of a number
deleted 2 characters in body
Loading…
revised
Largest number in ten bytes of code
Updated result for the new trillions value.
Loading…
awarded
revised
Loading…
revised
Loop without 'looping'
added 252 characters in body
Loading…
comment
Loop without 'looping'
Oh shoot. I just posted an answer with the same basic concept. I had been scanning the page for "JavaScript" or anything showing HTML tags. I suppose I might leave my answer up, just because it handles the corner-case where the location contains a "#". Anyway, +1.
answered
Loading…
comment
Loop without 'looping'
@Derek朕會功夫 setInterval is not a statement, though; it's only a function. It's used inside an expression statement, and if we can't use expression statements, then I just don't even know anymore.
comment
comment
Find the maximum of 3 numbers without branching
@ClydeLobo It's 6 because < and > cost double.
comment
Random script that isn't actually random
I had thought about doing exactly this, since it's a genuine common error for new programmers, and going to random.org is a perfect excuse. Might I suggest replacing +xhr.responseText with xhr.responseText|0 so that it looks even more like a reliable integer coercion?
comment
Largest number in ten bytes of code
@Ypnypn One of the rules currently says, "you may not use scientific notation to enter a number". The rules appear to barely leave open the possibility for our code to use scientific notation inside a string literal. Is that so? I suppose eval("9e9") still isn't quite as large as 9999999999.
comment
Random script that isn't actually random
@Matt I mean that |0, if you know what it does, looks like it's rounding down, and it is rounding down, so it's not a deception. (And if someone has no idea what |0 does, then there's no use for deceptive code; you can just tell them whatever you want them to believe.) Instead, the unexpected behavior in your answer is based on the fact that Math.random(0,4) is functionally identical to Math.random(), because Math.random doesn't use parameters.
revised
Return the flipped version of a number
best foot forward; clean up
Loading…
revised
Return the flipped version of a number
added 44 characters in body
Loading…
comment
Return the flipped version of a number
@edc65 You know, I'd wanted to use a string, and I had completely blanked on the fact that I could coerce the result back to a number. A bizarre lapse. Yet I still wouldn't have come up with -(x!=6). Thank you.
revised
Return the flipped version of a number
added 165 characters in body
Loading…
revised
Return the flipped version of a number
added 102 characters in body
Loading…
comment
Return the flipped version of a number
At first, I nearly posted function(x)[0,-1,5,-1,-1,2,9,-1,8,6][x], also thanks to Firefox. I wasn't going to win anyway, so I decided I'd just stick with the highest-compatibility answer. If I start switching languages for brevity, then I'll eventually start defining my own language for every challenge I do. But I'll go ahead and mention the ECMAScript 6 version anyway, since you suggested it