lilman Posted December 31, 2006 Share Posted December 31, 2006 When looking at JavaScript code I am having a tough time distinguishing Objects, Properties and Methods. Objects I am getting the hang of, but it is Properties and Methods that is a tad confusing. I hope someone can help me out and explain how you can distinguishing them apart. Quote Link to comment Share on other sites More sharing options...
AndyB Posted December 31, 2006 Share Posted December 31, 2006 http://www.utexas.edu/learn/javascript/objects.html Quote Link to comment Share on other sites More sharing options...
lilman Posted December 31, 2006 Author Share Posted December 31, 2006 Is it possible to have an object with a property without a method? Quote Link to comment Share on other sites More sharing options...
emehrkay Posted January 1, 2007 Share Posted January 1, 2007 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 doexample.meth(); //alerts trueand of course you can have an object without methodsvar obj = {eyes: 'brown', hair: 'black', height: '6\'0'} Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.