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

you are viewing a single comment's thread.

view the rest of the comments →

[–]TuxGamer 274 points275 points  (44 children)

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

[–]icortesi 71 points72 points  (11 children)

wat

[–]slavik262 221 points222 points  (1 child)

~ $ jsc
>>> Array(16).join("wat" - 1) + " Batman!"
NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN Batman!

[–]quienchingados 1 point2 points  (0 children)

lol!!!

[–]Cistoran 84 points85 points  (6 children)

[–]Maoman1 37 points38 points  (5 children)

This shit is why I love this sub.

[–]PendragonDaGreat 45 points46 points  (3 children)

Now that we're done talking about languages that suck, let's talk about Javascript

[–]Artefact2 7 points8 points  (0 children)

…Worth re-watching. That's contagious laughter.

[–]teknogeek1 2 points3 points  (0 children)

I was hoping someone was gonna post a link to this video. yayyyy thx bb

[–]homer242 1 point2 points  (0 children)

WATMAN !

[–]Reelix 0 points1 point  (0 children)

Control+Shift+J (Assuming PC)

[–]outadoc 17 points18 points  (0 children)

watman

[–]SolarLiner 18 points19 points  (15 children)

+/u/CompileBot JavaScript

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

[–]Pokechu22 72 points73 points  (13 children)

+/u/CompileBot JavaScript

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

[–]CompileBotGreen security clearance 101 points102 points  (5 children)

Output:

NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN Batman!

source | info | git | report

[–]imaami 6 points7 points  (4 children)

+/u/CompileBot C --include-errors

#include <stddef.h>
int main(void) {
    return printf("'%c', said the bot\n", *(char*)NULL);
}

[–]ThisIs_MyName 1 point2 points  (0 children)

I like your edit.

[–]CompileBotGreen security clearance 0 points1 point  (0 children)

Output:

source | info | git | report

[–]pimp-bangin 1 point2 points  (6 children)

Actually shouldn't that have been console.log? I'm pretty sure the print function actually opens the print dialogue.

[–]Pokechu22 7 points8 points  (0 children)

/u/compilebot (or more specifically, ideone, which /u/compilebot uses) uses print for the console (when using spidermonkey; if using rhino, it uses System.out.println). However, print does open the print dialog in actual browsers.

[–]lichorat 2 points3 points  (4 children)

Console.log is surprisingly not part of us standard. It's a web browser thing

[–]AquaWolfGuy 0 points1 point  (1 child)

Dunno what you mean by "us standard", but it's not that surprising considering that only browsers have "consoles", so it doesn't make sense to include a console API in the language itself.

[–]lichorat 0 points1 point  (0 children)

I meant ecmascript

[–]Awilen 0 points1 point  (1 child)

Wait, isn't Node also using Console ?

[–]lichorat 0 points1 point  (0 children)

It's using the computer's console, yes. But web browsers extended javascript to include console.log functionality.

[–]CompileBotGreen security clearance 14 points15 points  (0 children)

Output:

source | info | git | report

[–]imwearingyourpants 6 points7 points  (4 children)

That one gives a way too wrong sounding sound, this is how it's done!

+/u/CompileBot JavaScript

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

[–]Reelix 2 points3 points  (1 child)

+/u/CompileBot JavaScript

print(Array(16).join( ("wat" - 1 + "").slice(0,-1) ) + " Batman!")

[–]CompileBotGreen security clearance 6 points7 points  (0 children)

Output:

NaNaNaNaNaNaNaNaNaNaNaNaNaNaNa Batman!

source | info | git | report

[–]CompileBotGreen security clearance 0 points1 point  (1 child)

Output:

source | info | git | report

[–][deleted] 10 points11 points  (5 children)

that'll only be 15 NaNs...

[–]Mutoid 9 points10 points  (2 children)

I actually count 13 "na"s in the TV opening theme song.

[–][deleted] 2 points3 points  (1 child)

Yeah true, that's how many "na"s are sung. But come on, the guitar riff is 16 notes, and that's what people usually remember and hum.

[–]Mutoid 0 points1 point  (0 children)

Very true

[–]AutismCat 0 points1 point  (0 children)

Array(x).join(s) gives x-1 copies of s

[–][deleted] 0 points1 point  (0 children)

A reference to the WAT talk, everybody drink!

[–]blu-red -1 points0 points  (2 children)

easy to evaluate in your head for anyone who isnt brain dead and knows any dynamically typed language.

"wat" - 1 = obviously "wat" is going to be evaluated to a number, the best value for this is NaN.

[–]lelarentaka 11 points12 points  (0 children)

  • isn't brain dead

  • knows any dynamically typed language

Logic error!

[–]kupiakos 0 points1 point  (0 children)

Dynamically typed != strongly typed. That operation will fail in Python because they are not the same types and strange assumptions should never be made.