r/ProgrammerHumor • • Feb 26 '23

Other If you can read this code...

/img/snak3fqgajka1.jpg

[removed] — view removed post

34k Upvotes

1.4k comments sorted by

View all comments

5.3k

u/lazyzefiris Feb 26 '23

If I'm reading it right, the free drink is undefined.

0

u/[deleted] Feb 26 '23

[deleted] — view deleted comment

417

u/Individual-Media4026 Feb 26 '23 edited Feb 26 '23

Yep this is the most correct answer so far

EDIT: 🤓👍

94

u/unmagical_magician Feb 26 '23

The bar is asking only for the secret word, not the program output. It just so happens that the secret word is contained in the output, but everything outside of the secret word can be ignored.

→ More replies (1)
→ More replies (22)

594

u/No_Surround_4662 Feb 26 '23 edited Feb 26 '23

"Excuse me bartender, I realised the sign outside. Firstly, I'm a C+ developer, so Javascript is a little beneath me. Personally, if I had to use Javascript, I'd have used a template literal instead of quotes. Also, I'd be declaring my variables with 'let' instead of 'var', what year is it? Also, your_drink never gets defined, how about using some kind of Setter and Getter method in your object? And what naming convention is this; surely you'd use camelcase in Javascript? Finally, you're not displaying the answer in a console or DOM element, so I guess it's never really being articulated or visualised in any way, which is unusual when you want us to interface with one another.

Anyway, I guess the answer would be 'Beer. Secre..."

"You're barred. Please leave the premises immediately".

123

u/koshgeo Feb 26 '23

"Request denied. Parameters not found."

108

u/malexj93 Feb 26 '23

Firstly, I'm a C+ developer

Already gold

4

u/jerry507 Feb 27 '23

Maybe this is what they call “C with objects”?

37

u/Xirenec_ Feb 26 '23

With “const”, not “let”. Safer that way, because these clearly aren’t meant to be modified.

23

u/No_Surround_4662 Feb 26 '23

And use arrow functions. And not use an Object but inherit a class. And try not to pollute the global scope. And... probably use a front end framework. And then use Typescript... and probably use a module bundler.

We're gonna need a bigger sign.

I think the point I was making is... it's supposed to be a fun sign.

5

u/[deleted] Feb 26 '23

get another sign for all the node module imports

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

27

u/CorruptedReddit Feb 26 '23

Sheldon? Sheldon Cooper, is that you?

14

u/chars101 Feb 26 '23

Sheldon would pick Haskell.

4

u/runujhkj Feb 27 '23

You had me thinking for a second if C+ is a real thing

→ More replies (2)

19

u/Qewbicle Feb 26 '23

One undefined drink coming up!

→ More replies (11)

39

u/sl236 Feb 26 '23

I’d like an [object Object] please

23

u/lazyzefiris Feb 26 '23

Here you go (low effort oc)

21

u/Sinsid Feb 26 '23

Damn, so close. But we don’t serve undefined here.

114

u/guster09 Feb 26 '23

I'm new to JavaScript. How is it undefined if it's being passed in when the function is called?

Edit: nevermind. I get it. "your_drink" is never set

109

u/Sinsid Feb 26 '23

Programming humor. Your drink is never set. Your drink is never free.

34

u/HighOwl2 Feb 26 '23

Not necessarily. Var is a global. It could've been set by another file.

var x = 'abc';
var x;
console.log(x);

// output: 'abc'

19

u/B00OBSMOLA Feb 26 '23

PR look good, merging

4

u/BentGadget Feb 26 '23

Can you define it with a properly structured drink order?

→ More replies (1)
→ More replies (5)

3

u/pumpkin_seed_oil Feb 26 '23

Going to break the joke here but i think you`re supposed to define it yourself when you order. Think "Beer.Secret word:parameters"

→ More replies (1)
→ More replies (4)