Trying to understand the point of prototypes in JavaScript

前端 未结 2 563
自闭症患者
自闭症患者 2020-12-23 21:13

I realize this has been asked hundreds of times, however, I can\'t seem to grasp the concept of \"why\" prototypes in JavaScript are proper, as apposed to imitating classes

2条回答
  •  心在旅途
    2020-12-23 21:40

    prototype allows you to add methods and properties to a class and it will apply it not only to the class, but also any current object instances of that class.

提交回复
热议问题