- Prototypal inheritance forces an unstated empty object onto your object with key
prototype
- functions can act as object constructors but with the same syntax
- empty array members break loops
Infinity
/-Infinity
+0
/-0
null
is an object- testing
NaN === NaN
is always false typeof
always returnsobject"
for all different reference types- the type of
NaN
(not a number) is literally"number"
but as a string void
looks like a Java class but its only job is to returnundefined
undefined
is a global var which is different from but has type ofundefined
undefined
can also be redefinednull
andundefined
both exist- reference types were made to look like Java and should be avoided but are still force converted on to you under the hood on some objects
- the DOM api in general
this
- callback hell
- hoisting
parseInt()
defaults to base 2 not base 10.sort
converts array members to strings making10
appear before1
{ } + { } = ""
empty string0.1 + 0.2 = 0.30000000000000004
- you can monkey patch/blow away almost any built-in method in the language
"0"
and"false"
are truthy values+
symbol (unary operator) overloaded for addition and concatenation- auto semicolon insertion
new
required for object instantiation vs function reference with no errornew Boolean(false)
is true- global vars infect you everywhere
- oh and don't forget all browsers implement it a little bit differently just like CSS—especially critical features like event handlers, e.g.
click
Last active
August 10, 2023 21:39
-
-
Save richardcornish/fcd541ba87946d4ff6dd to your computer and use it in GitHub Desktop.
An incomplete list of bizarre failings of the JavaScript programming language
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment