In JavaScript, what is the difference between a method and a property? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

In JavaScript, what is the difference between a method and a property?

24th Jun 2018, 6:31 PM
Nick
Nick - avatar
3 Answers
+ 8
var obj={ x:5, dance:function(){} } properties are always strings,objects or numbers.. methods are functions
24th Jun 2018, 6:52 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 3
Also note that Methods and Properties are general programming concepts and not specific to Javascript or different in Javascript.
25th Jun 2018, 11:26 PM
Duncan
Duncan - avatar