1

Can anyone describe to which mechanism relates this behavior: When i try access to property of number

2.constructor

I get Uncaught SyntaxError: Invalid or unexpected token

When i try access to property of number in this way

(1).constructor

I get

ƒ Number() { [native code] }
Anton Krylov
  • 439
  • 6
  • 17

1 Answers1

4

You need another dot to distinguish the first decimal separator from a dot as a property accessor.

console.log(2..constructor);
Mamun
  • 62,450
  • 9
  • 45
  • 52
Nina Scholz
  • 351,820
  • 24
  • 303
  • 358