Posted on October 1, 2007 by Joey
It is very common in the programming world for the terms argument and parameter to be used to convey the same meaning. Technically, however, there is a distinct difference between the two.
When a function is defined, the expected variables are listed in parentheses. These are parameters.
For example:
function GetSquarePerimeter(sideLength)
{
return 4*sideLength;
}
In the preceding example, sideLength is a parameter of the Square function.
When a function is called, there is a list of variables that are passed to the function. The evaluation of these variables results in values that are passed to the function. These are arguments.
For example:
var intSideLength = 4;
var intPerimeter = GetSquarePerimeter(intSideLength);
At runtime, when the intSideLength variable is evaluated to 4, it is an argument to the GetSquarePerimeter function call.
Filed under: JavaScript, programming, software | Tagged: arguments, parameters | Leave a Comment »
Posted on October 1, 2007 by Joey
The ‘this’ keyword is indispensable in JavaScript object-oriented programming. When used in a JavaScript constructor function, ‘this’ refers to the object. Through the ‘this’ keyword, properties and methods can be assigned object, also known as a class. For example:
function Square(intSideLength)
{
this.sideLength = intSideLength;
}
In the preceding example the ‘this’ keyword is used to assign the variable ’sideLength’ as a property of the Square class.
The ‘this’ keyword is also frequently passed as a parameter on JavaScript events, such as when a checkbox is clicked. In such an instance, ‘this’ refers to the current object, the checkbox.
Filed under: programming, software | Leave a Comment »
Posted on September 29, 2007 by Joey
JavaScript object properties can be enumerated by using a for/in loop, as demonstrated below:
var objCar = new Object();
objCar.wheels = 4;
objCar.tires = 4;
objCar.engines = 1;
for (var i in objCar)
{
document.write(i);
document.write('<br/>');
}
The result of this code is:
wheels
tires
engines
Filed under: JavaScript, programming, software | Leave a Comment »
Posted on September 29, 2007 by Joey
An object can easily be created in JavaScript by creating a new instance of the native JavaScript Object class. Following this, properties can be assigned to it, as follows:
var objCar = new Object();
objCar.wheels = 4;
document.write(objCar.wheels);
Filed under: JavaScript, programming, software | 1 Comment »
Posted on September 29, 2007 by Joey
A constructor that is created in JavaScript can have methods defined for it. These are called ‘instance methods.’
For example, suppose the following constructor was defined in JavaScript:
function Square(intSideLength)
{
this.sideLength = intSideLength;
}
In this example, ’sideLength’ is an instance property and each instantiation of the Square class will have it’s own copy of the ’sideLength’ property. Instance methods work a little differently. They are defined through the prototype property of the constructor. For example:
Square.prototype.perimeter = function() {return 4*this.sideLength;}
document.write(mySquare.perimeter());
The perimeter method is thus an instance method of the Square class. Instance methods differ from instance properties in JavaScript in that each instantiation of the instance method is shared among instantiations of the class.
Related articles:
Object-Oriented JavaScript
JavaScript Instance Properties
Filed under: JavaScript, programming, software | Tagged: object oriented | Leave a Comment »
Posted on September 29, 2007 by Joey
JavaScript can easily be enabled and disabled in Internet Explorer through a check box that is found at the following location in Internet Explorer:
- Click ‘Tools’ on the menu bar’
- Select ‘Internet Options’
- Click the ‘Security’ tab
- Click the ‘Custom Level’ button
- Scroll to the ‘Scripting’ section
- Select ‘Disable’ to disable JavaScript
- Select ‘Enable’ to enable JavaScript
- Select ‘Prompt’ to be prompted whether to allow JavaScript to run on a page
Related Articles:
How to Enable and Disable JavaScript in Mozilla Firefox
Filed under: JavaScript, technology | Tagged: ie, internet explorer, microsoft | Leave a Comment »
Posted on September 29, 2007 by Joey
A mashup is a web application hybrid. Mashups take information from more than one source and combine it into one application. The combination of these multiple applications makes the mashup more useful collectively than the individual applications are themselves.
A common example of a mashup is a website that uses Google Maps within its site to show visually where an address exists. So there is a web page with an address on it that becomes much more useful when another application, Google Maps, is combined with it to provide further information.
For example, see below an example from a real estate site that uses Google Maps to show the locations of local neighborhoods.

Filed under: JavaScript, ajax, programming, software, technology | Tagged: google maps, mashups | Leave a Comment »
Posted on September 26, 2007 by Joey
JavaScript can easily be enabled and disabled in Firefox through a check box that is found at the following location in Mozilla Firefox:
- Click ‘Tools’ on the menu bar
- Click ‘Options’ from the menu
- Click on the ‘Content’ section in the pop up box
- Click the ‘Enable JavaScript’ check box to enable JavaScript; remove the check in the box to disable JavaScript
Related articles:
How to Enable and Disable JavaScript in Internet Explorer
Filed under: JavaScript, technology | Tagged: firefox, mozilla | Leave a Comment »
Posted on September 26, 2007 by Joey
A constructor that is created in JavaScript can have properties defined for it. Each instantiation of the constructor has it’s own copy of the properties. These are called ‘instance properties.’
For example, suppose the following constructor was defined:
function Dog()
{
this.legs = 4;
}
From this constructor, two instances of the Dog class could be instantiated:
var myDog = new Dog();
var myDog2 = new Dog();
Each of these instances has the same value for the ‘legs’ property but they eahch have their own copy.
document.write(myDog.legs);
document.write(myDog2.legs);
Related articles:
Object-oriented JavaScript
JavaScript Instance Methods
Filed under: JavaScript, internet, object oriented, programming, software, technology | Leave a Comment »
Posted on September 25, 2007 by Joey
Ajax polling is when a browser makes an asynchronous request to a server at regular intervals to see if anything has changed on the server. When it is determined that a change has been made, the page can be updated accordingly.
For example, a page showing product information which includes quantity available, could be polling the server consistently to see if the quantity available has changed. If so, that can be immediately reflected on the page, without any interaction from the user. This simple technique has a multitude of uses – it’s simply up to designers and developers to use their imaginations and find the most appropriate places to use this tool.
Filed under: JavaScript, Web, Web 2.0, internet, joey javascript, programming, software, technology | Leave a Comment »