0

Why we are using object method?

This concept is very interesting but i am not getting where to use this method.

1st Jul 2017, 2:40 PM
shashanth
shashanth - avatar
3 Answers
+ 3
maybe if ur doing html games or other stuff, prototyping can be very useful to you. is the course still teaching es5 pop? just wondering. learn es6 instead, its sleek class Dog { constructor(s) { this.name = s } bark() { console.log(`Woof! My name is ${this.name}!`) } } something like that lol so u can do this myDog = new Dog("Brady") myDog.bark() // this is the thing that u wanna find out ok imagine if ur doing a pET DOG SIMULATION and youre creating so many dogs, it will be easier for you to manage if u have two objects of the instance Dog, idk how to explain tbh but its quite interesting P.S. ES5 is sth like this (which is what u might be learning in sololearn lol) function Dog(s) { this.name = s } Dog.prototype.bark = () => { console.log("My name is " + this.name + ".") } close enough xd
1st Jul 2017, 3:11 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 2
When projects getting complicated. Modular design would be the crucial parts. All functional web modules would be built in components. Object orientation programming which emphasise on modular design and reusablility would be used to build all the web components. Javascript framwork likes ReactJS uses Javascript components as the building blocks for the all the apps.
1st Jul 2017, 3:07 PM
CalviŐČ
CalviŐČ - avatar
0
Thank you @cheeze
1st Jul 2017, 3:01 PM
shashanth
shashanth - avatar