Jump to content

Looking for a little clarification


lilman

Recommended Posts

here is an example of an object with methods and properties

[code]
var example = { // object
ex: true,  // property

meth: function(){
if(example.ex == true){
alert(example.ex);
}else{
alert('False');
}
} //method
}
[/code]

and to call i the method you'd do

example.meth();  //alerts true

and of course you can have an object without methods

var obj = {eyes: 'brown', hair: 'black', height: '6\'0'}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.