nic

game? designer??

  • they/them

various credits on:
The Banished Vault
Arcsmith
John Wick Hex
Quarantine Circular
Subsurface Circular
Vienna Automobile Society
Sun Dogs

 

P&P microgames:
In the Court of the Skeleton King
The Garden
Tallships

 
Chicago


You must log in to comment.

in reply to @xkeeper's post:

Any idea why it wraps to 1? All I can think of is that something's refusing to accept Infinity, coercing it to true and from there to 1, but I can't think of anything in JS that would act that way?

It's either this specific javascript engine, this specific browser, this specific app, or something in between. Trying this out on both chrome console and a node.js repl and I get the expected behaviour of continued scientific notation past 1e+21

Ooh, this seems to work?

let i = '0';
for (let j = 0; j < 25; ++j)
  console.log(i = parseInt(i + '9').toString());

Here i is whatever value is in the text box, which I assume is always stored as a string because HTML.

Essentially the error is that the first time scientific notation appears it's rendered "correctly" and then the time after that parseInt truncates it at the .

Interestingly it takes almost 200 steps to start repeating.

I have no idea why you would bother adding parseInt in there if it's always a string, or indeed why you wouldn't just use <input type="number"> like a normal person but I mean that's JS devs for you, they'll never use a hammer if there's a giant mech warrior available that can also in theory hammer in a nail.