March 9, 2001 - Finding the Object's Value
![]() |
March 9, 2001 Finding the Object's Value Tips: March 2001
Yehuda Shiran, Ph.D.
|
Object object's method of toString(). When the object consists of a number, like:
var myNum = new Number(35);
the toString() method returns the string "35". When the object is user-defined, the method returns [object Object]. Try it for the following Employee object:
function Employee() {
this.dept = "HR";
this.manager = "John Johnson";
}
function printProp() {
var Ken = new Employee();
alert(Ken.toString());
}



