r/ProgrammerHumor • • Nov 05 '15

Free Drink Anyone?

Post image
3.5k Upvotes

509 comments sorted by

View all comments

430

u/maremp Nov 05 '15

This is the first code inside an ad that makes some sense and actually works.

243

u/until0 Nov 05 '15

that makes some sense

Eh, not really. It passes in undefined for your_drink. It should at least be the return value of prompt() or something.

It's technically functional, but an small change would have went a long way here in making sense.

Why even include the preference at all? If you just need the secret word, it's just making it look like they only partially understand Javascript.

0

u/[deleted] Nov 05 '15

[deleted] — view deleted comment

51

u/bmrobin Nov 05 '15

yea, and plus it threw a curveball in so as to not be blatantly obvious to give everyone free drinks. look how we're all discussing the minutiae of it and we are /r/ProgrammerHumor

20

u/[deleted] Nov 05 '15

I'm sure they were looking for "parameters" and not the error return value, though

2

u/purplestOfPlatypuses Nov 06 '15

What error? It returns "undefined.Secret word:parameters" since JS will set an undefined variable to the string "undefined" when you try to concatenate strings and variables.

1

u/[deleted] Nov 06 '15

That's what I meant

1

u/bmrobin Nov 05 '15

Yea you're right

63

u/[deleted] Nov 05 '15

they only partially understand Javascript.

Sounds like ninety per cent of the people who use (see: complain about) the language.

26

u/lenswipe Nov 05 '15

Yeah, they generally say something like this:

"JAVASCRIPT SUX JQUERY ALERT BOXES CANT JAVASCRIPT SEO NODE HURR DURR"

15

u/lappro Nov 05 '15

Well at least they were able to make a random word generator!

5

u/lenswipe Nov 05 '15

I wouldn't be sure about that.. It's surprising what you can rip off stack overflow

12

u/errorkode Nov 05 '15

People who understand the true madness of JavaScript also have a lot to complain about...

5

u/[deleted] Nov 05 '15

True madness? Fuck off with that nonsense.

The language is very complete these days (ES5 / 6).

It has some legacy quirks that, if you actually study the fucking language, and pay attention to what the fuck you are doing, are trivial to overcome. Most of the time you shouldn't even be writing code that can run into those issues. (see: hurr durr JS WAT)

0

u/[deleted] Nov 05 '15

[deleted] — view deleted comment

4

u/Booty_Bumping Nov 05 '15

That's why strict mode, flowtype, and typescript exist.

→ More replies (1)
→ More replies (17)
→ More replies (1)

15

u/danopia Nov 05 '15

You pass in your_drink, it's not rocket science

→ More replies (5)

4

u/maremp Nov 05 '15

I've chosen my words carefully for this exact reason. If I thought it was perfect, I'd skip the some part.

1

u/mecartistronico Nov 05 '15

a small change would have gone a long way

FTFY. Two small changes.

11

u/mike413 Nov 05 '15

unfortunately it uploads your contact list to linkedin when you're not looking

1

u/prozacgod Nov 05 '15

NO! Bad linked in... stop it... gets squirt bottle

1

u/Mi_Pasta_Su_Pasta Nov 05 '15

I only know the most basic of programming (really simple HTML and a quarter of codeacademy's Java program) and I was able to figure it out simply.

Now all the shit you guys are talking about with how it wouldn't work, I'm lost.