Javascript Bizzars
var a = {a: 1};
var b = {a: 1};
a.prototype === b.prototype
true
a === b
false
a + b
[object Object][object Object] String
a - b
NaN Not a number
Equality [] === []
false
Equality [] === new Array()
false
Equality [] === {}
false
Equality {} === {}
false
Equality {} === new Object()
false
Array Addition [1,2] + [1,3]
1,21,3
Array Subtraction [1,2] - [1,3]
NaN
Not a number
Array + Object Addition [] + {}
[object Object]
String
Object + Object Addition {} + {}
[object Object][object Object]
String
Subtraction [] - []
0
Number
Subtraction [] - {}
NaN
Not a number
Subtraction {} - {}
NaN
Not a numberWritten by Igor Ivanovic
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Object
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#