[OT] Programming language WATs

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Feb 6 12:40:05 PST 2012


On Mon, Feb 06, 2012 at 09:11:35PM +0100, HansBKK wrote:
> On Friday, 20 January 2012 at 20:59:57 UTC, Denis Shelomovskij
> wrote:
> >But with a mistake: there are 15 delimiters in 16 element array
> >(printing/join result), not 16.
> 
> That is truly sad - not only that you counted the commas, but
> publicly admitted it 8-)

More Javascript WATs:

	[]+1	// "1" (a string, not a number)
	[]-1	// -1 (a number, not a string... WAT?)

	{}+1	// 1 (a number, not a string... huh?!)

	[]+"a"	// "a" (weird, but OK)
	{}+"a"	// NaN (WAT?)

Even worse:

	"a"+[]	// "a" (weird, but OK, consistent with []+"a")
	"a"+{}	// "a[object Object]" (WAT? inconsistent with {}+"a")


T

-- 
If it's green, it's biology, If it stinks, it's chemistry, If it has
numbers it's math, If it doesn't work, it's technology.


More information about the Digitalmars-d mailing list