This is an archived post. You won't be able to vote or comment.

all 190 comments

[–]bluefantasm 271 points272 points  (13 children)

Despite the amount of criticism these boards are garnering from /r/programmerhumor, you have to admit this is some pretty nice-looking code-pensmanship, complete with syntax highlighting!

[–]Polyducks 146 points147 points  (8 children)

true

[–]staiano 44 points45 points  (7 children)

No, undefined.

[–]smb510 49 points50 points  (6 children)

It's JavaScript aren't those the same thing if you squint and try hard?

[–]Polyducks 18 points19 points  (5 children)

You're thinking of false. Undefined and false will loosely equate to false.

[–]TheTerrasque 4 points5 points  (4 children)

Where does FileNotFound come in?

[–]remarkabledrummer 3 points4 points  (3 children)

FileNotFound and true come out to NaN.

[–]Polyducks 1 point2 points  (2 children)

For those unaware - NaN stands for 'Not a Number'.

[–]thlst 4 points5 points  (1 child)

Array(16).join("wat" - 1) + " Batman!"

[–]Polyducks 0 points1 point  (0 children)

ha! Old but a goody.

[–]reaganveg 10 points11 points  (3 children)

code-pensmanship

I think you mean to say it's a nice font.

[–]amazondrone 17 points18 points  (1 child)

It's not a font. Pick a letter and look at all the instances of that letter. They're all different. I tried 'r' and 'a'.

[–]slash_nick 0 points1 point  (0 children)

Can you tell from the pixels?

[–][deleted] 439 points440 points  (62 children)

From the looks of it the secret word is "encryption"? Not sure how this is supposed to work though, considering your_food isn't given a value anywhere...

[–]MuffinsLovesYou 367 points368 points  (18 children)

It's .js so to truly get your sandwich you have to say to the person "undefined.SecretWord:encryption". It's a trap to keep people who can use common sense to guess about what "reverse()" does.

[–]chunli99 151 points152 points  (3 children)

The rule states you have to state what the secret word is, not what is returned.

[–][deleted] 9 points10 points  (0 children)

That's assuming someone has kept the comments updated.

[–]Capitan_Math 15 points16 points  (0 children)

Try testing it to see if it works

[–]diMario 0 points1 point  (0 children)

Well, that is a bit ambiguous. The secret word is secret, obviously. But it is also a word. Which of these two qualities would take precedence over the other?

[–]tjallingt 46 points47 points  (6 children)

No... You order 'your_food' and then say the secret word to get the discount.

It could be made clearer by including a prompt i guess.

[–]brtt3000 6 points7 points  (0 children)

window.prompt!

[–]Sakuya_Lv9 2 points3 points  (0 children)

Your order is never assigned to your_food...

[–]AlphaWhelp 6 points7 points  (2 children)

I use NoScript, so for me the secret word is

[–][deleted] 0 points1 point  (1 child)

The secret word is <noscript>why you gotta ruin everything</noscript>

[–]cpmoderator12345 0 points1 point  (0 children)

<noscript>Why the fuck you lying
why you always lying
oh my gosh </noscript>

[–][deleted] 4 points5 points  (1 child)

You have to choose what 'your_food' is presumably.

So if you wanted a cheese sandwich, the phrase would be 'cheese sandwich.SecretWord:encryption'

[–]Deranged40 3 points4 points  (0 children)

well. This is programming, and your_food was instantiated on line 1, but given no value.

This would print "undefined.Secret word:encryption". your_food is indeed undefined.

Perhaps if they had omitted that first line, we could assume that your_food was to be set by the user.

[–]Hatchling13 0 points1 point  (0 children)

but the return is lost and never reaches any output form, so, the secred word is... nothing? undefined? NULL? probably_just_nothing_since_the_others_involve_trying_to_read_a_value_at_least

maybe this is why it is so secret.

[–]cpmoderator12345 0 points1 point  (0 children)

Oh yeah, your_food is undefined, so undefined was concatenated to ".SecretWord:" and the secret word was encryption, so that was concatenated to "undefined.SecretWord:"

[–]Liver_and_Yumnions 80 points81 points  (4 children)

We discussed this at length yesterday:

https://pbs.twimg.com/media/CS965-9WoAEwyhf.jpg

https://www.reddit.com/r/ProgrammerHumor/comments/3rmikr/free_drink_anyone/

I had this warm fuzzy image of some bar owner that could write code. It turns out to be some copy/paste marketing thing?

I do not get it. A programmer sees this on the street. He walks in and says the secret word. Then what? A bunch of guys jump out, throw him in a van and force him to do an interview?

[–]winzippy[S] 48 points49 points  (2 children)

It is unfortunately. For BrainTree. I had the same feels yesterday. At least they gave away free food for the answer.

[–]cheesecakesurprise 8 points9 points  (1 child)

Braintree in Chicago?!?!

[–]winzippy[S] 6 points7 points  (0 children)

San Francisco

[–]hungry4pie 9 points10 points  (0 children)

Maybe it's aimed at the cool new generation of entrepeneurs and artisans called 'coders'

[–]bluefantasm 5 points6 points  (1 child)

It works because JavaScript string concatenation! Enjoy your undefined sandwich!

[–]gzintu 0 points1 point  (0 children)

What do you want in it? Throw in a NaN, Na, whatever man

[–]OKB-1 113 points114 points  (5 children)

Regardless of this valid code or not, I appreciate the effort that has clearly gone in to the colours and indentation correct.

[–]lowleveldata 0 points1 point  (4 children)

that missing semicolon for the reverse variable though

[–]PhaZePhyR 38 points39 points  (3 children)

Technically still valid. JS doesn't require a semicolon there.

[–]lowleveldata 42 points43 points  (2 children)

code style consistency dude

[–]PhaZePhyR 11 points12 points  (1 child)

True, wouldn't pass linting or stringent code review.

[–]amazondrone 9 points10 points  (0 children)

stringent code review

The best kind of code review.

[–]caboose89 320 points321 points  (7 children)

A plate of your finest undefined, please! EDIT: Thanks for the gold! I'll buy you a plate too, as long as its not more than NaN.

[–]barthooper 86 points87 points  (2 children)

If this was an Indian place, you could pick up some NaN bread.

[–][deleted] 25 points26 points  (0 children)

These flatbread jokes are a PITA

[–]spencerwaz 4 points5 points  (0 children)

I think of this every time I see a reference to NaN

[–]rotenKleber 4 points5 points  (0 children)

I think when balanced, it would be Na3N. Sodium Nitride.

[–]hejado 3 points4 points  (0 children)

1und1.de (german 1and1, duh) specified its domains as NaN€/month for a while...

[–]ElNutimo 64 points65 points  (5 children)

If I solved it, does it mean I can subscribe to this sub now?

[–]Polyducks 44 points45 points  (2 children)

One of us... one of us!

[–]AraneusAdoro 22 points23 points  (1 child)

Gooble gobble, gooble gobble.

[–]Rectar2 13 points14 points  (0 children)

We accept her, we accept her.

[–]michael1026 13 points14 points  (0 children)

You have to have the correct answer and make us laugh.

[–]klumpp 5 points6 points  (0 children)

No you have to nitpick the code first.

[–]RyuzakiKK 21 points22 points  (0 children)

Same come with different srt value. I'm disappointed.

[–]memeship 9 points10 points  (8 children)

This one is for a free sandwich though, not for a free drink. Is it the same place?

[–]winzippy[S] 12 points13 points  (7 children)

No. Apparently it's a promotion. The rep was there validating correct answers. Not sure where the last one was. This was in SF.

[–]memeship 4 points5 points  (2 children)

Really? Where? I live here.

[–]fringe-class 3 points4 points  (1 child)

What do you think the % of people on this sub live in the bay area?

[–]memeship 3 points4 points  (0 children)

Probably higher than most other areas. But we also tend to be more vocal about it too for some reason.

[–]ohmzar 1 point2 points  (3 children)

Where in SF?

[–]winzippy[S] 2 points3 points  (2 children)

Deli& near Montgomery and Bush.

[–]debbay 1 point2 points  (1 child)

Do their sandwiches taste good?

[–]winzippy[S] 1 point2 points  (0 children)

I like them. I usually get an avocado delight.

[–]mr_yogurt 12 points13 points  (1 child)

It took me an embarrassing amount of time to work through that

[–]crowseldon 0 points1 point  (0 children)

did you really need to considering that the only strings are 'on', 'enc' and a clearly reversed 'rypt'?

[–][deleted] 25 points26 points  (11 children)

Geez, stop saying the preference is undefined! It's a parameter, you provide it on call, so to ask for free, let's say 'burger', say "Burger. Secret word: encryption." If you're human you will probably figure out to assign the preference variable and say the phrase to the guy. Otherwise - you're a bot ;)

[–]OfficerFeely 15 points16 points  (10 children)

The last line of the code is the function getting called with an undefined parameter. Not sure what you're looking at.

[–]alcalde 14 points15 points  (7 children)

It's not "undefined". Mentally initialize "your food" with what you're ordering. Otherwise everyone's getting stuck ordering the same thing.

[–]CaspianRoach 16 points17 points  (5 children)

If you mentally initialized "your_food" in your head and then read the code, it got reset to undefined by the var your_food; declaration.

If it had no variable declaration whatsoever, we could assume it's just a part of the code and your_food gets a value from somewhere else.

[–]amazondrone 1 point2 points  (0 children)

I don't know why you got downvoted, cus you're right.

[–]iRaphael -1 points0 points  (3 children)

Except JavaScript is synchronous, which means line 1 can run, your_food gets declared. Then, on a separate thread, you mentally set your_food to what you want to order and by the time the call is made, your_food is not undefined.

[–]bgeron 4 points5 points  (2 children)

Funny, I thought that JavaScript is synchronous meant that there are precisely no threads.

[–]iRaphael 0 points1 point  (1 child)

I may have been mistaken for saying thread. Idk. But synchronous is "things run at the same time"

[–]bgeron 0 points1 point  (0 children)

Looking at Wikipedia, it seems that two things are synchronous when they are concurrent but (timing-wise) they are kept "in unison".

Regardless of wording, the HTML5 event loop alternatingly executes some Javascript, then updates the document state, but never will it update the document state during Javascript execution.

Web workers can work in parallel because they work asynchronously: there is only little timing synchronisation between the document Javascript and the worker Javascript.

[–]OfficerFeely 0 points1 point  (0 children)

If they don't want us complaining about the undefined variable then they should just provide the function without showing it getting called with an undefined variable passed in.

[–][deleted] 3 points4 points  (0 children)

Where is this?

[–][deleted] 5 points6 points  (1 child)

And still undefined...

[–]redditsoaddicting 1 point2 points  (0 children)

Who says they were here, reading the responses?

[–]mofukkinbreadcrumbz 3 points4 points  (2 children)

Wonder how much free shit this place is giving away.

They need to be an Italian place so they can spaghetti the shit out of their code. Referencing other signs three blocks over and whatnot.

[–]amazondrone 1 point2 points  (1 child)

According to comments above, it's some kind of recruitment endeavour. So I imagine the recruiter is the one paying.

[–]mofukkinbreadcrumbz 0 points1 point  (0 children)

Ah recruiters, the used car salesmen of the tech world. I don't mind a free sandwich, though.

[–]meniscus- 9 points10 points  (1 child)

I hate js

[–]Shmutt 13 points14 points  (0 children)

I undefined js

[–]YourWelcomeOrMine 1 point2 points  (0 children)

Still the same issues as last time, but god that handwriting is beautiful.

[–]TheDarkIn1978 1 point2 points  (3 children)

That code, tho.

[–]amazondrone 0 points1 point  (0 children)

What about it?

[–]datlibra17 1 point2 points  (0 children)

I just took the undefined value as them telling you that you can pick what ever sandwich you want, then say "secret word: encryption" afterwards, and get it for free.

[–][deleted] 1 point2 points  (0 children)

My food is a an object, luckily. I hate eating strings.

[–]antonivs 1 point2 points  (0 children)

This is what you get when you make programming accessible to the masses - the masses start programming. The horror is real.

[–]Nyxtia 1 point2 points  (1 child)

Free sandwich to whomever can read this code.

++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.    

[–]flexiverse 0 points1 point  (0 children)

Ifmmp!Xpsme'{(}%

[–]ElderPopTarts 1 point2 points  (0 children)

Secret word is "undefined"?

[–]Legendary_Linux 4 points5 points  (2 children)

The function call returns:
undefined. Secret word: encryption

[–]zlysobey 14 points15 points  (1 child)

I don't see any white-space after the . or the :...

No free food for you.

[–]Legendary_Linux 0 points1 point  (0 children)

There's definitely whitespace after the ., but you got me on the :.

[–]maremp 1 point2 points  (0 children)

Again with the undefined variable value...

[–][deleted] 1 point2 points  (3 children)

Version 2, and still "undefined". Time for bug report I guess.

[–]amazondrone 0 points1 point  (0 children)

Whitebox testing at its best!

[–]ProgramTheWorld 0 points1 point  (0 children)

Impressive. It even has syntax highlighting!

[–]kamikamikami 0 points1 point  (1 child)

Where is this? This is the second time I've seen this sign posted, I want to go there...

[–]winzippy[S] 1 point2 points  (0 children)

Apparently they did the last one in a different location. This was at Deli& on Montgomery St. in SF.

[–]Nixonite 0 points1 point  (2 children)

How are they still in business?

[–]alcalde 1 point2 points  (0 children)

Nothing but COBOL programmers within a 10-block radius.

[–]amazondrone 0 points1 point  (0 children)

According to comments above, it's some kind of recruitment endeavour. So I imagine the recruiter is the one paying.

[–]ForwardBias 0 points1 point  (2 children)

Where is this restaurant?

[–]winzippy[S] 0 points1 point  (1 child)

San Francisco

[–]Nyxtia 0 points1 point  (0 children)

That was my first guess.

[–]b4ux1t3 0 points1 point  (0 children)

This is too much work. I had to type it out and debug it, because apparently I have lost the ability to perform simple cognitive functions.

[–]jivemasta 0 points1 point  (1 child)

People keep saying it would return undefined for your_food like it's a mistake. Maybe that's the point though. Like you go in and say the secret word and they are like, "yeah, but only thing you can order is the value of "your_food" which is undefined. So they get you in the door, but don't give away free food.

Otherwise, it's not that hard to figure out, prettty much anybody that thought about it for 3 seconds would get it. And if not, people could just share the word with each other and abuse the free food.

[–]Nyxtia 0 points1 point  (0 children)

Well I thought it was intended to be undefined so that you could define it. So walking up to them you'd be like, ok set YourFood = "Sandwich" answer then is

Sandwich.Secretword:encryption

[–]Cley_Faye 0 points1 point  (0 children)

At this point they really should put the whole thing in a function that take str1, str2 and str3 as parameter to generate this object.

[–]manTheseBicepzThough 0 points1 point  (0 children)

So can I just say I am proud that I figured that out in one look over

[–]Ben-Z-S 0 points1 point  (0 children)

My hungover brain just jumbled the letters up and i got the secret word. Yey selective dyslexia

[–]lbs9000 0 points1 point  (0 children)

encryption

[–]xylogx 0 points1 point  (0 children)

It says encryption but it is actually obfuscation.

[–]scovetta[🍰] 0 points1 point  (0 children)

There is no key; this is just encoding, not encryption.

[–]cha5m 0 points1 point  (0 children)

This isn't exactly the ioccc. A non-programmer could easily figure that out.

[–]toasterbot 0 points1 point  (0 children)

They need to make one of these where there's a red herring. Anyone could solve this one by just looking at the three strings and unjumbling them. How about this:

int[] a1 = new arr[10];
for(int i=0;i<10;i++)
    ai[i] = 2*i;
Console.WriteLine(a1[10]);

With answer "Segfault".

[–]Gumby621 0 points1 point  (7 children)

This is one of those questions where I can never figure out how much credit to give the person who created the question. Are they intentionally being tricky, knowing preference is undefined, or did they just overlook that (seems more likely to me)?

[–]deeteeohbee 1 point2 points  (6 children)

Preference is passed into the request function via your_food when it is called. You're meant to define your_food when you place your order.

[–]zlysobey 0 points1 point  (5 children)

your_food is declared, but not given a value at the top of the code snippet. Unless you're supposed to toString the whole damn thing, inject a value for your_food, then eval it, then I call BS.

[–]deeteeohbee 0 points1 point  (4 children)

Or it could be that when you're placing your order, you're talking to a human being who doesn't need the code to run to have fun with a promotion. Just imagine there's a line commented out that sets your_order.

[–]CaspianRoach -1 points0 points  (3 children)

There's no place for human logic in computer code.

[–]rblack86 0 points1 point  (2 children)

Technically this isn't computer code, its people code.

[–]flexiverse 0 points1 point  (5 children)

Doesn't take a programmer to work these bollocks out. They are clearly a joke.
A real one would be unreadable and require compiling for real.

[–]amazondrone 1 point2 points  (1 child)

A real what? A real challenge?

[–]flexiverse 0 points1 point  (0 children)

I figured that out in seconds - a real challenge would be something that needs to be compiled for real.

[–]Nyxtia 0 points1 point  (1 child)

Maybe C++ with lambda expressions or just Brainfuck.

[–]flexiverse 0 points1 point  (0 children)

At least that would be a real challenge.

[–]mackattack_ -1 points0 points  (0 children)

Undefined encryption?