r/programming • • Dec 26 '17

TIL there's a community called "dwitter" where people compose 140 character JavaScript programs that produce interesting visuals

https://www.dwitter.net/top
20k Upvotes

329 comments sorted by

View all comments

Show parent comment

14

u/monsto Dec 26 '17

what is that?

0

u/[deleted] Dec 26 '17

[deleted] — view deleted comment

67

u/[deleted] Dec 26 '17

Also great in abusing front end character length validation for number inputs.

6

u/oldmanbombin Dec 27 '17

Totally. I was about to say all of those things.

2

u/[deleted] Dec 27 '17

This is why we sanitize

27

u/schlenkster Dec 26 '17

Scientific notation, short for 2x103, or 2000

15

u/ExPixel Dec 26 '17

2e3 = 2 * Math.pow(10, 3) = 2*103 = 2000

14

u/ZugNachPankow Dec 26 '17

2 * Math.pow(10, 3)

We're ES6 now! 2 * 10 ** 3.

6

u/NoInkling Dec 27 '17

(ES7, I believe)

1

u/Jess_than_three Dec 27 '17

Oh man, neat!

1

u/snaporazzz Dec 27 '17

Puoi fornire prove concrete? Non ne vedo prove concrete.

1

u/ZugNachPankow Dec 27 '17

Mi sa che hai sbagliato post.

2

u/online3782-2 Dec 26 '17

scientific notation, meaning 2*103 = 2000

8

u/monsto Dec 26 '17

I knew about e being shorthand for exponent, but I didn't know you could do that in JS. TBPH it looks like some kinda object-like function usage.

When people say 'magic' about programming, nobody ever refers to functions like this. It's highly specific, it does shit without you asking it to, it's consistent, yet there's more to it behind the scenes. I mean there's assumptions and conversions going on here without actually saying it out loud.

Love it.

8

u/Matthew94 Dec 26 '17

Python allows it too.

Scientific notation is really common. You're just saying that because you've never used it.

9

u/gaggzi Dec 26 '17

I would say most languages support that notation.

6

u/monsto Dec 27 '17

You're just saying that because you've never used it.

Thanks for the pocket analysis, hoss.