object oriented javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

object oriented javascript

Can you give me a little bit advance javascript program or project that is object-oriented? I already know the basics.

17th Aug 2018, 4:54 PM
Ronalyn Joy Sardañas
Ronalyn Joy Sardañas - avatar
2 Answers
+ 6
var Ronalyn={ name:"Ronalyn", socialMedia:"Sololearn", level:"Silver", gender:"Female" } function Intro(){ console.log("Hi I'm "+this.name) console.log("I'm using "+this.socialMedia) console.log("I have a "+this.level+" badge") } Intro.call(Ronalyn) Output ====== Hi I'm Ronalyn Am using Sololearn I have a silver badge. Explanation ========== The above code creates an object called Ronalyn with properties like Level Name socialMedia It then creates an introduction method that introduces the object. The method is then called on the Ronalyn object, and the output is seen above
17th Aug 2018, 5:05 PM
Dlite - avatar
+ 2
Good example Yahiko, don't forget comma on 4th line ☺
17th Aug 2018, 5:21 PM
null - avatar