A function is a first-class
JavaScript Object
• Functions are a bit like Java methods
> They have arguments and return values
• A function is a first-class object in JavaScript (unlike in Java)
> Can be considered as a descendant of Object
> Can do everything a regular JavaScript object can do such as storing properties by name
> Function objects can have other function objects as methods
A function can take Variable arguments
• You can call myfunction() or myfunction(20)
function myfunction(value){
if (value){ this.area=value;
}
return this.area;
}
0 Responses So Far: