Object Types and Scopes
JavaScript is object-based. This means that every value in JavaScript is an object. As with any Object Oriented language, the properties and methods are associated with each object and need to be invoked by qualifying the names with the object name.
// the following statements are equivalent
var name = first_name.concat(last_name);
name = first_name + last_name;
As is the case in C++ and Java, if a script is running inside an object scope, it can reference its properties and methods without qualifying the name. There is a global scope in JavaScript, which provides the common methods. Since every script is running inside a global scope, those methods do not need to be qualified.
// parseInt() is a global method
var num = parseInt(parameter['count']);
// toFixed() is a number method, so it needs to be qualified
var int_num = num.toFixed(0);
| << Declaration and Assignment | © 1996-2013 InetSoft Technology Corporation (v11.4) | Number Type >> |