<img id=”myimage” onclick=”changeImage()”
src=”pic_bulboff.gif” width=”100″ height=”180″>
<p>Click the light bulb to turn on/off the light</p>
The isNaN() function determines whether a value is an illegal number (Not-a-Number).
This function returns true if the value is NaN, and false if not.
var z=x+y; //is very similar to normal algebra
When you assign a text value to a variable, put double or single quotes around the value.
When you assign a numeric value to a variable, do not put quotes around the value. If you put quotes around a numeric value, it will be treated as text.
var name=”John Doe”;
var answer=’Yes I am!’;
var x = 5; // Now x is a Number
var x = “John”; // Now x is a String
Properties and Methods
Properties are values associated with an object.
Methods are actions that can be performed on objects.
A Real Life Object. A Car:
The properties of the car include name, model, weight, color, etc.
All cars have these properties, but the values of those properties differ from car to car.
The methods of the car could be start(), drive(), brake(), etc.
All cars have these methods, but they are performed at different times.
You can use objects in the following way..
var person=new Object();
document.write(person.firstname + ” is ” + person.age + ” years old.”);