37

Learn you some Javascript

Comments
  • 0
  • 4
    I really don't like the split personality between primitives and objects...
  • 14
    five = dis.call(5) assigns object via "this"

    five.wtf = 'potato' assigns wtf prop to object [Number: 5]

    five * 5 == 25, it gets a number from that object, multiplies it by 5 -> same as typeof(5+'a') is string and it doesn't modify the original value of 5

    five++ gets value from object, adds 1 _and_ modifies original value to the new_value = old+1 (i.e. 6)

    five now _isn't_ object

    you can't assign properties to numbers(in a non-retarded way), therefore "undefined"

    five is number 6, not object
  • 1
    maybe it's an object. maybe it's not. who knows.
Add Comment