Object Types and Scopes

JavaScript is object-based. This means that every value in JavaScript is an object. As with any Object Oriented (OOP) language, properties and methods associated with each object generally 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.

Text1.text = "Hello"; // in report script

text = "Hello";       // in Text1 script

JavaScript also has a global scope which provides common methods. Since every script runs within global scope, these 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.5) Number Type >>