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
  • 112,162
  • 17
  • 191
  • 293
Micah
  • 3,911
  • 7
  • 29
  • 33

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,165
  • 7
  • 54
  • 72