JavaScript

"" + 1 + 0 = "10"
"" - 1 + 0 = -1

what a shit show

Attached: 1516149161477.jpg (1920x1080, 380K)

Why would you ever need to know what "" + 1 + 0 equals?

>2 + 2 + 2 + 2 + '1' + 2 + 2 + 2 + 2 = 812222
Do you really agree with this?

Why would you ever need to do that?

t. never heard of concatenation

Yes, because I'm not retarded.

t. never heard of type definition
>uses javascript
>says he isn't retard

I actually use Coffeescript, but yeah. I'm sorry that you're not intelligent enough to understand dynamic types.

Types can be dynamic, but silent type casting should be outlawed.

>I actually use Coffeescript
[email protected]

>do retarded shit
>get retarded results

t. never heard of implicit casting

You really only have to worry about this stuff if you're outsourcing some of your code. I can't imagine how you'd end up in a situation like that where a function is returning a number as a string and you need to perform operations on it. Seriously, if you end up in a situation like that you need to nuke your code base.

Yes, it's perfectly logical.

If you know how js works a d that all tpyes are basically boxed, but not boxed and have valueOf() an toString()s protos... It's really straightforward.

>t. never heard of type definition
shhh
Nouveau-Jow Forums does not understand types, it's all magic that the computer is supposed to take care of. Because it's "; echo date('Y');

>Type defs
>2019

Do you even infer types bro? Hell you can usually write almost an entire codebase in languages like ocaml without writing a single type declaration.

let a = 0;
let b = "0";
Boolean(a) = false
Boolean(b) = true
a == b = true

JS fags will defend this

>Hell you can usually write almost an entire codebase in languages like ocaml without writing a single type declaration.
and that's a bad thing

...how? It's still strongly typed and statically checked, unless you abuse the very friendly ocaml gradual type system.

try
a === b

>>> "" + 1 + 0
Traceback (most recent call last):
File "", line 1, in
TypeError: can only concatenate str (not "int") to str
>>> "" - 1 + 0
Traceback (most recent call last):
File "", line 1, in
TypeError: unsupported operand type(s) for -: 'str' and 'int'


Based Python

IP addresses are usually stored as strings, but ports and subnet masks as ints. You should be able to see how this can go very wrong

Why would JavaScript code ever have to deal with IP addresses? Brainlet.

>needing to be spoonfed
peabrain

The actual shitshow is expecting anything different when using the decade old practice of adding a string as a first thing to force the plus operator to do concatenations.

god you're such a attention seeking cocksucker.

reactive shit, sessions?

[1, 2, 10].sort()
Array(3) [ 1, 10, 2 ]

new Date()

Why would ip addresses be stored as strings? To be able to easily use them in place of domain names?

>use sort function wrong by invoking default comperator
>complain on brainlet board
nigger

How is that supposed to be an issue?

>Sorting doesn't default to the natural order of the contents
>This is defended as ok language design

still better than an error / crash

If this actually gives you problems then you're too retarded to know how your own code is working.

>javascript bad, goy!!!!
>dont ask questions why goy!!!

>Sorting doesn't default to the natural order of the contents
it does. As all entries are Object the default comperator sorts them by their string representation

Must feel bad to be this retarded

this can not be real

Attached: SmoothEnchantingAmericansaddlebred.webm (480x270, 126K)

what
the
fuck
is
wrong
with
you