-1

Today I'm reading "javascript the definitive guide." in chapter 3.5 talk about the global object.There said:

global properties like undefined, infinity, and NaN

Because of my lack knowledge, I feel I could not understand it. In my mind, I feel undefined Infinity and NaN are values I don't know how could these are properties. Thanks for any thoughts.

wow javascript is so confusing I just check this:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined

undefined is a property and this property value is also undefined.
if this understanding is wrong please correct me.

3 Answers3

0

It simply means that they could be used in anywhere of your code at any time, i.e, they are always available to you in any scope of code.

Reference: http://www.w3schools.com/jsref/jsref_obj_global.asp

Reuel Ribeiro
  • 1,419
  • 14
  • 23
0

Properties of the global object are properties you can use anywhere without specifying the object

  • Instead of window.undefined you can write undefined
  • Instead of window.console.log you can write console.log
  • etc...
user3
  • 740
  • 3
  • 15
-2

The Global properties refers the variables that can be used anywhere throughout the document and need not be declared.

I would provide you this standard ECMA Language Specification for complete reference.


  1. Update: For Down voters.

The reason to provide ECMA as a reference is here


  1. Update: undefined is a property and this property value is also undefined.

Your understanding this perfectly correct.


Explanation is as:

  • undefined value

         primitive value used when a variable has not been assigned a value
    
  • Undefined type

         type whose sole value is the undefined value
    

as mentioned in the above standard link in sections 4.3.9 and 4.3.10. I was trying to convey this message but I posted just the link.

Community
  • 1
  • 1
Aravind
  • 40,391
  • 16
  • 91
  • 110