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. Link to comment https://forums.phpfreaks.com/topic/32404-looking-for-a-little-clarification/ 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 Link to comment https://forums.phpfreaks.com/topic/32404-looking-for-a-little-clarification/#findComment-150500 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? Link to comment https://forums.phpfreaks.com/topic/32404-looking-for-a-little-clarification/#findComment-150502 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'} Link to comment https://forums.phpfreaks.com/topic/32404-looking-for-a-little-clarification/#findComment-150572 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.