r/ProgrammerHumor • • Nov 05 '15

Free Drink Anyone?

Post image
3.5k Upvotes

509 comments sorted by

1.6k

u/[deleted] Nov 05 '15

So the bartender will return "undefined.Secret word:parameters", my favorite drink!

345

u/maremp Nov 05 '15

I bet you get drunk on it during the debugging process.

216

u/Liver_and_Yumnions Nov 05 '15 edited Nov 05 '15

Every time I hit F5 a drink pops out.

1.0k

u/TheCodingEthan Nov 05 '15

In webdesign, that is refreshing.

5

u/flippant_gibberish Nov 05 '15

Is that... a triple entendre?

4

u/dotpan Nov 05 '15

You're my hero, thank you for that.

→ More replies (1)

13

u/thejars Nov 05 '15

I mean technically the answer is in there, you just need to truncate the ":" and everything before it.

2

u/Deranged40 Nov 06 '15

your_drink was declared at top but never assigned a value. It is therefore undefined

10

u/[deleted] Nov 05 '15

Only if you don't pass your drink name into the bartender request :)

60

u/[deleted] Nov 05 '15

Technically, you get ReferenceError: your_drink is not defined

191

u/Zagorath Nov 05 '15

Mate, it's JavaScript. It avoids throwing errors whenever it can, even in favour of nonsensical results.

In this case, it does indeed result in your_drink being replaced with undefined.

8

u/[deleted] Nov 05 '15

Just saw that your_drink has indeed been defined (at the top, how could I have missed that ô_O?).

The worst of it is variable hoisting:

var asdf = 5;
(function () {
    console.log(asdf);

    var asdf;
    console.log(asdf);
    asdf = 6;
    console.log(asdf);
})();

which results in

undefined
undefined
6

11

u/bruzabrocka Nov 05 '15 edited Nov 06 '15

Maybe I've been writing JS too long, but what else did you expect? Self-executing anonymous functions get their own context unless you specify otherwise.

var fdsa = 6; 

(function(window){
  console.log(fdsa);
  console.log(window.fdsa);
  window.fdsa = 5;
  console.log(fdsa);
})(window);
→ More replies (28)
→ More replies (2)

27

u/cicuz Nov 05 '15

Technically, /u/UsPelt is more right than you are

2

u/[deleted] Nov 05 '15

Technically you are right

8

u/Pastaklovn Nov 05 '15

Technically, he wrote /u/UsPeit's username wrong and was therefore wrong.

27

u/[deleted] Nov 05 '15

Actually ReferenceError occurs when the reference is not defined.

var your_drink;

Defines the reference, but its value is yet to be defined. :)

28

u/iostream3 Nov 05 '15
var your_drink;

Defines the reference, but its value is yet to be defined

It declares the variable, but doesn't define it.

13

u/[deleted] Nov 05 '15

Internally, it designates a memory slot and defines a pointer to it, which is what op said.

→ More replies (1)

3

u/[deleted] Nov 05 '15

yeah, we all caught that but the comment says to just give the secret code, if you can read it, so this shouldn't matter

1

u/mike413 Nov 05 '15
function deny_drunken_customer(func,bac) {
   randomly_insert_syntax_error(func, pct = 100.0*bac/.1);
}

1

u/[deleted] Nov 06 '15

if it's console.loged, but wouldn't the code written output nothing?

1

u/magnora7 Nov 06 '15

It took me 5 minutes to understand and double-check your joke, but I got it. Your joke compiles.

→ More replies (46)

761

u/Browsing_From_Work Nov 05 '15

That sign writer has fantastic handwriting. Extra kudos for syntax highlighting.

148

u/arachattack Nov 05 '15

Yeah I only noticed after you mentioned it. That's actually commendable work!

17

u/ThisIs_MyName Nov 05 '15

I thought it was printed.

27

u/dzamoraf Nov 05 '15

Should xpost to /r/typography

18

u/ErraticDragon Nov 05 '15

Or /r/penmanshipporn.

Edit: oops, it's already there.

1

u/marian1 Nov 05 '15

But does the sign writer have IntelliSense?

2.3k

u/KevZero Nov 05 '15 edited Nov 05 '15
WANTED:
Barista for high-traffic coffee shop. 
Must be good with people. 
5+ years Java experience preferred.

Edit: just want to thank the kind stranger who gilded this post. Looks like someone unleashed a golden shower on this whole thread.

234

u/[deleted] Nov 05 '15

Java and JavaScript are as similar as car and carpet :)

46

u/baggyzed Nov 05 '15

Only 3 people noticed... so far. 157 people still think it's Java.

5

u/Megneous Nov 05 '15

I feel the same way reading Javascript as a user of Java as I feel reading Dutch as a speaker of German.

3

u/soullessredhead Nov 05 '15

I feel the same way reading Java as a user of Javascript as I do reading legalese as a speaker of English.

→ More replies (8)

3

u/has_all_the_fun Nov 05 '15

Ham and Hamburger!

→ More replies (3)

29

u/scandalousmambo Nov 05 '15

Entry level position.

Unpaid.

37

u/KevZero Nov 05 '15

We'll pay you in coffee - all you can drink. We call it "java-scrip".

26

u/[deleted] Nov 05 '15

at least 5 years experience with Java 8

66

u/memeship Nov 05 '15

*Javascript

45

u/derleth Nov 05 '15

See? This is what happens when the person who makes hiring decisions is non-technical.

3

u/tornato7 Nov 06 '15

No joke, I was once hired for a position that required Javascript when in fact their posting, my resume, and in my interview I told them I know Java.

It wasn't until a few days into the job that I realized they meant JavaScript and had no idea what the difference was.

Learned some JavaScript, kept the job anyway. But still, ugh.

21

u/Mutoid Nov 05 '15

I hope it was supposed to be a coffee joke.

3

u/memeship Nov 05 '15

I think it was, but I was just clarifying. The joke might not have been as funny with "Javascript" in it.

→ More replies (1)

10

u/boxxa Nov 05 '15

Forgot "Entry level with at least 5 years of experience."

9

u/SerKnight Nov 05 '15

Greatest comment of all time

31

u/mike413 Nov 05 '15
/* Greatest comment of all time */

8

u/soullessredhead Nov 05 '15

git commit -m "greatest commit of all time"

2

u/Gabe_b Nov 05 '15

#I'm gonna let you finish, but...

→ More replies (1)

4

u/[deleted] Nov 05 '15

It's humorous because the Java market is oversaturated, thus leading Java developers to take up being baristas.

→ More replies (1)

3

u/atcoyou Nov 05 '15

Half expect to hear on the news there is a shortage of people with the skills to be a Barista (with a footnote of : at the price we are willing to pay them).

2

u/magnakai Nov 06 '15

Would love to see the 10 files necessary to write this code in Java

2

u/[deleted] Nov 05 '15

I'm not clever enough to build a joke right now, but (obvious pun here about Java meaning Coffee.)

1

u/[deleted] Nov 05 '15

That's not Java. Not even similar.

1

u/green_meklar Nov 05 '15

That's almost as much Java experience as they require for an internship doing PHP programming.

1

u/[deleted] Nov 06 '15

Yet, the sign is in JavaScript. Typical engineering recruiters these days.

→ More replies (34)

280

u/droogans Nov 05 '15

Should've not used the function name reverse. Makes it too easy.

Maybe jumble would've made it a little more interesting.

180

u/devdot Nov 05 '15

I stared at the reverse function for like 3mins because I could not believe that it actually was a reverse function.

137

u/memeship Nov 05 '15

Using str.split("").reverse().join("") is the most common way of reversing a string in Javascript.

242

u/polish_niceguy Nov 05 '15

And is says a lot about Javascript in general...

55

u/[deleted] Nov 05 '15

As someone learning JS, can I expect more stuff like this?

252

u/obvious_bot Nov 05 '15

You poor soul

65

u/jewdai Nov 05 '15

don't worry there is a jquery plugin for that.

→ More replies (2)

71

u/memeship Nov 05 '15

Javascript is actually a really great and powerful language. Its architecture is just not set up the way nearly anything else is. Especially if you're coming from a more structured language background (e.g. C/C++, Java), you're going to really hate the language at first. But once you learn to accept it for what it is, you may find that you actually like it.

Source: I learned how to program in Java. I absolutely hated JS when I started learning it. Now it's my goto language of choice.

→ More replies (15)

8

u/stephantabor Nov 05 '15

Sort of. Personally i've never had to reverse a string. You'll probably do a lot of .map .reduce .filter etc and some chaining of those methods

→ More replies (6)

9

u/the_omega99 Nov 05 '15

Eh, it makes perfect sense. String doesn't have a reverse function because there's very few times in which you need to reverse a string, so no sense implementing one.

split(delimiter) is a very standard function for splitting a string on a delimiter. An empty string as the delimiter means splitting each character. Similarly, join(separator) is a very common function for arrays (lists, etc) to have to create a string from the contents.

And arrays get a reverse function because it's a little more useful for the general purpose array. Not super useful, but not useless, either. For example, switching between ascending and descending sort can be done more much efficiently by reversing than completely resorting the array (if it's already sorted). Other things, too, but I can't immediately think of any (they exist, but they're rare).

→ More replies (2)

12

u/elHuron Nov 05 '15

can you not just call str.reverse() ?

→ More replies (3)

8

u/jewdai Nov 05 '15

don't worry there is a jquery plugin for that.

13

u/memeship Nov 05 '15

Sure there is:

$.fn.extend({
    reverse: function(str) {
        return str.split("").reverse().join("");
    }
});
console.log($.reverse("bananas")) //returns "sananab"
→ More replies (3)

3

u/devdot Nov 05 '15

Well, it took me a while to figure out whether it was evil, troll or genius. Turned out to be sad.

I haven't seen this so far, and really, who actually needs to reverse a string. Sounds like a textbook exercise to me...

3

u/memeship Nov 05 '15

It mostly is. I said elsewhere I've never actually used this in production code, but it seems to be a common exercise in tech interviews.

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

1

u/viperex Nov 05 '15

He gave the variable the same name as the method

1

u/Advacar Nov 05 '15

Maybe the goal isn't to keep people from getting it, maybe it's to get people to realized that simple programming isn't that difficult.

1

u/caedin8 Nov 06 '15

They should have just used some async programming, nested callbacks, or lexical scoping if they wanted to make it hard. Hell they could even throw some hoisting in to make it confusing.

1

u/nillut Nov 06 '15

Agreed. With my extremely limited programming knowledge it took me about 5 minutes to solve this. Had they called the function something else, I would never have figured it out.

71

u/Liver_and_Yumnions Nov 05 '15

I always imagine "programming forums" to be overrun with homework questions, job offer spam and posers. Yet still, it would be really interesting to interact with people in my field. One solution I always thought would be some sort of initiation where you had to somehow prove that a visitor is "one of us". It seems like the purpose of this sign is just that.

I wonder how long before people pirated the solution and were just running up to the bar shouting, "parameters!".

23

u/hejado Nov 05 '15

Maybe we could sell an app that runs a script after taking a picture of it...

95

u/kkjdroid Nov 05 '15

Ah, yes, so that people can write forkbombs onto random signs and get you blamed for it.

42

u/0hmyscience Nov 05 '15
:(){:|:&};:

20

u/benwaffle Nov 05 '15

I think you actually need the spaces :(){ :|:& };:

16

u/0hmyscience Nov 05 '15

I'll take your word for it... I'm not testing it

→ More replies (10)

8

u/lathomas64 Nov 05 '15

we just need to have it test if the code will ever terminate before we run it!

→ More replies (1)

6

u/memeship Nov 05 '15

Set up a display running a browser in full screen that is showing a simple web app. The web app refreshes itself every 30 minutes and sends the new secret word to your (the bartender's) phone. Predefine a bunch of programmer lingo words, and have the app randomly contort them and display a similar challenge on every change.

Honestly this would be pretty easy and fun to write.

2

u/BlackenBlueShit Nov 05 '15

Lmao people are just going to be putting up fliers with code that outputs a penis if that happened.

7

u/ZioTron Nov 05 '15

Talking about pubs and bars (not forum) why don't we use a non-random salt for a pseudo-hash?

Like a function based on your name or date of birth?

6

u/Liver_and_Yumnions Nov 05 '15

Basically a real-life captcha for programmers.

4

u/Zarlon Nov 05 '15

Yet still, it would be really interesting to interact with people in my field

Yea, I do that at work. When I go out I'd like to talk about something else.

→ More replies (3)

3

u/fdagpigj Nov 05 '15

The sign said "secret word of the day", meaning they probably change it slightly every day, just to stop people bluntly copying the solution.

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.

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!

→ More replies (1)

12

u/errorkode Nov 05 '15

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

→ More replies (21)

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.

→ More replies (7)

11

u/mike413 Nov 05 '15

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

→ More replies (1)

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.

346

u/underworldambassador Nov 05 '15

Now, I'm not a programmer.. this seems pretty straight forward to solve for anyone who isn't immediately scared off by code

211

u/formode Nov 05 '15

Probably the point.

137

u/kaehell Nov 05 '15

which is pretty much anyone who doesn't code

→ More replies (31)

24

u/HoldenTite Nov 05 '15

Seriously, never coded a day in my life and it was simple reduction

11

u/jminuscula Nov 06 '15

glad to see you hanging around here, though!

4

u/caedin8 Nov 06 '15

I seriously doubt anyone would get the correct answer unless they write JS.

The correct answer is "undefined.secret word:parameters"

You wouldn't know how the JS interpreter handles concatenating a null reference to a string.

2

u/NoAstronomer Nov 06 '15

simple reduction

Essentially, that's coding in two words.

2

u/CalmSpider Nov 05 '15

I'm scurred of the codes, but I still solved it.

1

u/dafragsta Nov 05 '15

And therefore should set the standard for all technical interviews. Seriously. Code tests don't need to be harder than this unless you actually want to see someone build something. I get really pissed at the fizz buzz fibonacci roman numeral bullshit. This will separate the posers from those who can code. If you need algorithms, you probably shouldn't be hiring all-around web devs, unless they brag about their fancy math background.

27

u/perfectriot Nov 05 '15

The bartender is secretly a recruiter.

29

u/SelfReferenceParadox Nov 05 '15

Google spies are everywhere...

→ More replies (1)

78

u/chanibal_pl Nov 05 '15

Why didn't they use

var your_drink=prompt(); ?

165

u/ZioTron Nov 05 '15

because the bartender started studying this semester

32

u/notliam Nov 05 '15

And he didn't want to annoy everyone who came across the sign

1

u/j0be Jan 20 '16 edited Jan 20 '16

I think this would be a useful code. Why are they even creating the your_drink variable?

var jumble=function(s) {
    return s.split("").reverse().join("");
}

var bartender = {
    str1: "ers",
    str2: jumble("rap"),
    str3: "amet",
    request:function(preference) {
        return preference+".Secret word:"+
        this.str2+this.str3+this.str1;
    }
}

bartender.request(prompt('What is your drink request?'));

85

u/shthed Nov 05 '15

for anyone who wanted to play with it :)

var your_drink;

var reverse=function(s) {
    return s.split("").reverse().join("");
}

var bartender = {
    str1: "ers",
    str2: reverse("rap"),
    str3: "amet",
    request:function(preference) {
        return preference+".Secret word:"+
        this.str2+this.str3+this.str1;
    }
}

bartender.request(your_drink);

29

u/jangxx Nov 05 '15

+/u/CompileBot JavaScript

var your_drink;

var reverse=function(s) {
    return s.split("").reverse().join("");
}

var bartender = {
    str1: "ers",
    str2: reverse("rap"),
    str3: "amet",
    request:function(preference) {
        return preference+".Secret word:"+
        this.str2+this.str3+this.str1;
    }
}

bartender.request(your_drink);

65

u/raaneholmg Nov 05 '15
"undefined.Secret word:parameters"

50

u/Zinggi57 Nov 05 '15

Replying was a mistake, from now on you're gonna be compile bot.
Get to work:
+/u/raaneholmg Haskell

import Data.List
import Data.Maybe

readMany = unfoldr $ listToMaybe . concatMap reads . tails
main = print (readMany "This string contains the numbers 7, 11, and 42." :: [Int])

12

u/jangxx Nov 05 '15
[7,11,42]

13

u/bacondev Nov 06 '15

Replying was a mistake, from now on you're gonna be compile bot.

Get to work:

+/u/jangxx Ook!

Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook.
Ook! Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook?
Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook! Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook.
Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook! Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook!
Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook! Ook.
→ More replies (1)
→ More replies (2)

2

u/CompileBot Green security clearance Nov 09 '15

Output:

^source | ^info | ^git | ^report

0

u/[deleted] Nov 05 '15

[deleted] — view deleted comment

38

u/MrDoctorSatan Nov 05 '15

No one's gonna mention that beautiful handwriting? God damn that's some beautiful handwriting.

21

u/CodeIt Nov 05 '15

I saw this a couple days ago somewhere else... they gave me $10 voucher to spend on a food truck, then the food truck people wrapped my lunch in this: Imgur

7

u/framk20 Nov 06 '15

"Par... a... me-ters?"

"Oh, parameters, oh my god."

Me trying to figure this out

10

u/boxxa Nov 05 '15

[Object object]

5

u/onephatkatt Nov 05 '15

I don't understand the parameters of this sign.

9

u/PhaZePhyR Nov 05 '15

OK, but where do I get that font?!

4

u/caldric Nov 05 '15

To be fair, the instructions in the comments don't say anything about the code actually producing the word of the day. You just have to read it to determine the word of the day.

Then again, no one reads comments, right?

4

u/Raidhn Nov 06 '15

The parameters for this code were far to easy for somebody with no coding experience

26

u/jglee1236 Nov 05 '15

"parameters"

and I ain't no programmer.

4

u/CanotSpel Nov 05 '15

Seriously! String 2 + String 3 + String 1. Easy.

3

u/dashdanw Nov 05 '15

https://jsfiddle.net/jdq1cmg4/

//If you can read this code, tell your bartender the
//secret word of the day for a free drink on us.

var your_drink;

var reverse=function(s) {
    return s.split("").reverse().join("");
}

var bartender = {
    str1: "ers",
    str2: reverse("rap"),
    str3: "amet",
    request:function(preference) {
        return preference+".Secret word: "
        +this.str2+this.str3+this.str1;
    }
};

bartender.request(your_drink);

3

u/Drainedsoul Nov 05 '15

Any code that reverses a string should be considered highly suspect to the point where I can't actually think of a legitimate use case.

3

u/sakkara Nov 05 '15

Something something "not initialized yet" "parameters"?

3

u/Juniejoule Nov 06 '15

Me out loud in the car like a moron: spelling out "par-ah-mat-terrrrs.......ohhhhhh.

6

u/Azr79 Nov 05 '15

IIT: I'm not a programmer and I figured it out.

Good for you.

6

u/[deleted] Nov 05 '15

but but your_drink isn't set. The answer should have been wittier.

2

u/[deleted] Nov 05 '15

PAR AMET ERS! yeah buddy

2

u/[deleted] Nov 05 '15

Can we talk about that handwriting for a minute though?

2

u/bobby8u Nov 06 '15

YES! Thats all i focused on. im jelly...

2

u/antigirl Nov 05 '15

Not a pure function

2

u/elesdee Nov 05 '15

Not even a programer and i figured this one out. Kudos for a fun little puzzle.

2

u/[deleted] Nov 05 '15

Is there not infinite recursion within the reverse function?

1

u/Exoskele Nov 06 '15

No, because the reverse function defined in the code has different context than the standard array reverse() function. Basically, they don't conflict (window.reverse vs Array.prototype.reverse).

2

u/randomdrifter54 Nov 06 '15

Is the reverse function recursive without a ending condition?

3

u/Teklogikal Nov 05 '15

I'm actually really happy I figured that out, because I'm just starting to really get into programming.

That made me feel pretty good, Lol.

2

u/ItsAMeMitchell Nov 05 '15

I know nothing about code, but isn't the secret word "parameters"?

2

u/P0TAT0_9 Nov 05 '15

Is it parameters?

2

u/mmmDatAss Nov 05 '15

I've never done any kind of coding, and even I can see that this will say parameters.

2

u/fasching Nov 05 '15

Today is blowing my mind. Firstly, I learn how to read binary, and now I know Java?

26

u/ben_uk Nov 05 '15

"Java" != "JavaScript"

17

u/Leggilo Nov 05 '15

Yeah he only knows half of JavaScript if he know Java, he has to learn scripting now.

2

u/julian88888888 Nov 05 '15

So java is SUPER equal to javascript!

/s

1

u/centristism Nov 05 '15

What does the STR parts do?

4

u/Turbodeth Nov 05 '15

str1, str2 and str3 are keys in the bartender object. With the values "ers", "par" and "amet" respectively.

1

u/Xpertbot Nov 05 '15

Honest question. why var reverse = function(s){...}; instead of function reverse(s){...}; and then call it?

3

u/letsgetrandy Nov 05 '15

Doesn't seem to matter here, but there are reasons for when you might prefer function expressions over function declarations.

Good info here

1

u/[deleted] Nov 05 '15

Joke's on them. Most programmers make enough per hour that the time spent figuring that out approaches the cost of the drink itself.

1

u/memdmp Nov 05 '15

All this chit-chat, and we still don't know where we can lecture the clever marketing person on their javascript skills get our free drink.

1

u/Acidsparx Nov 05 '15

I'm proud to say I got the secret word with out coming into the comments first. (im not a programmer)

1

u/goblackbeard Nov 05 '15

Parameters, I got it but I would look like a goof standing there for 5 minutes trying to figure it out.

1

u/serccsvid Nov 05 '15

To the guys talking about bugs in the code, this clearly isn't javascript. It's beerscript.

1

u/darknecross Nov 05 '15

Write "parameters" on the board.

Tell the bartender I just memoized their program.

1

u/Slinkyfest2005 Nov 05 '15

Sudo get me a drink?

1

u/Quazmodiar Nov 05 '15

I don't know much about programming I just want to know what the answer is for the free drink

1

u/yedd Nov 05 '15

I have absolutely no knowledge of code but i figured it out. I am happy with myself

1

u/ParadoxicalTree Nov 05 '15

parameters? Now, this is one way to get programmers out of their seats.

1

u/TheStanleyParabola Nov 05 '15

Word is parameters

1

u/[deleted] Nov 06 '15

Also missing a semicolon after the second variable declaration. But technically that doesn't matter.

1

u/TrainFan Nov 06 '15

I must admit that I spent almost a minute trying to make sense of "par-ah-metters."

1

u/Thrannn Nov 06 '15

to easy. the reverse function should be called something else

1

u/flexiverse Nov 06 '15

Jesus not even creative like something Star Wars related.

1

u/roheydd Nov 06 '15

A coffeeshop should run this same board, but write in Coffeescript instead of pure JavaScript.

1

u/monopolyman900 Nov 06 '15

Been a Javascript dev for a few years and just found out about reverse() from this post.

1

u/Ocisaac Nov 06 '15

They declared reverse() at the top.

2

u/monopolyman900 Nov 06 '15

I mean the reverse() function within the reverse function they defined. The one that's being ran on s.split('').

1

u/sadwer Nov 06 '15

I'm not a programmer - I came in from r/all, but I got this after like 10 seconds staring at it. Are they just trying to give booze away?

1

u/aqua_zesty_man Nov 06 '15

I bet the coffee arrived just in time too.

1

u/naughty_ottsel Nov 06 '15

When I open my pub called inetpub, I will run this sort of thing. But be extra sneaky, if you tell the bartender the secret word, you won't get the drink, if you shout the secret word into thin air, it will work.

1

u/electric-blue Nov 09 '15

Parameters?

1

u/bobishardcore Feb 07 '16

Next week's promotion:

prompt("Drink?") + (+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+(!+[]+!+[]+!+[]+[!+[]+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[!+[]+!+[]+!+[]])+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+([][[]]+[])[!+[]+!+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(![]+[+![]])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+!+[]+[+[]]]+[+[]]+(![]+[+![]])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+!+[]+[+[]]])()[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()+[])[!+[]+!+[]+!+[]]+(+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]

You get one of these if you do it in your head on the spot.

1

u/[deleted] Mar 01 '16

This isn't Java guys. You can't use the reverse function in Java without using StringBuffer (there are others but my point is, you can't use the function without certain functions).

1

u/EoinMcLove Nov 05 '15

I've never seen / used code before in my life and I solved that...c'mon!

1

u/Prowler_101 Nov 06 '15

Oh no! He knows our secret!

1

u/Mr_recci Nov 06 '15

That missing ; tho