Just why, Sup Forums?
Ugh why
learn how to objects and the difference between string compare and integer compare
>0777
In every decent language prefixing a number with 0 means it's base 8, 0777 is actually 511
Two empty arrays not being equal is completely fine because they are two different objects with different memory location.
0777 being larger than 800 and 600 is also false in real world because 0777 is 511 in octal notation.
I don't even like JS but try harder with your bait next time.
>ugh
kys faggot
>In every decent language prefixing a number with 0 means it's base 8
C was the JavaScript/PHP of its time.
That happens in literally no language ever.
>>>/reddit/
Nice samefag, retard.
No, php is web c but even less rules
No, it was the java of its time.
>slow as balls
>buggy as shit
>impossible to write stable software with it
>high-level and bloated
>worse than pretty much everything else currently available in every possible way
Even better:
{} + []
> 0
[] + {}
> "[object Object]"
>That happens in literally no language ever.
It happens in a lot of languages but a lot of them have also switched to "0o" notation instead to make it less vague.
Oh yeah:
{} + 3
> 3
3 + {}
> "3[object Object]"
>but all of them only ever had
FTFY
This, mesa, CPL and various Algol was better.
At least the first two are actually pretty logical, user.
I can understand [] == [] because it's comparing them by identity, but [] == ![] being true makes no sense at all. ![] evaluates to false. It also means [] sometimes acts like true and sometimes acts like false.
Silly me, I read !==. You're right of course.
the jit probably just compiles to []!=[]
this picture just gave me 90's nostalgia. Anyone else? Looks like one of those Disney movies kek
>{} + []
+[] is 0
automatic ; insertion makes that into {}; +[], thus 0.
>[] + {}
+ joins the array with ',' then appends the rest, treats {} as object literal and converts to string
>{} + 3
Also works with {}+"3"(=3) and doesn't with {}+"a"(=NaN)
same auto semicolon bullshit removes the {} part, and then an unary plus tries to convert shit to number
>3 + {}
converts both to string
The "{} + shit" isn't really an issue because it doesn't happen with variables, and the rest kind of makes sense.
Can you guys post all them images you have of the guy holding the degree with the bad code at the side.
Nothing gets me like those.
>This, mesa, CPL and various Algol was better.
The real problem is that schools don't teach these languages. People say C strings are "character arrays" but C strings aren't safe because it doesn't have real arrays.
It wasn't 0 vs 1 based, but 0 vs arbitrary lower bounds with 1 as a default. Fortran, BASIC, Algol 60/68, PL/I, Pascal, Ada, and so on allowed arbitrary lower bounds and had multidimensional arrays too.
Some students today believe that that null-terminated strings were an improvement over other kinds of strings.
Fuck C strings though
I'd rather do them manually instead of their arbitrary rules.