2

May I ask a size of undefined or null on a variable, which is bigger in javascript??

a = undefined

b = null

a > b ? undefined is bigger : null is bigger
leppie
  • 115,091
  • 17
  • 196
  • 297
Micah
  • 4,254
  • 8
  • 30
  • 38

1 Answers1

6

Types are incomparable. Thus, neither a nor b is the biggest:

> var a = undefined
undefined
> a
undefined
> var b = null
undefined
> b
null
> a > b
false
> b > a
false

(source: Developer Tools' console)

edit: if you're asking about the memory footprint, it depends on the implementation of the Javascript Engine you're using.

janesconference
  • 6,333
  • 8
  • 55
  • 73