![prototype javascript prototype javascript](https://pictures.topspeed.com/IMG/crop/201812/10-of-the-ugliest-co-2_1600x0w.jpg)
With a traditional compiled OOP language you'd need to subclass the input object and create a custom flavor that allows a timesChanged property. For example, assume you are a web developer and you want to keep track of how many times the user changes the value of a certain text input (say, the quantity of items ordered). On the other hand, this can be a real boon over compiled programming. That JS auto-creates and references previously-undefined properties can be dangerous, as mentioned above-the JS interpretter never yells at you if you attempt to read the value of, or go ahead and set the value of a property that just doesn't exist. Var spacing = myTable //equally as validĪnd why you can create property names that no reasonable compiler would ever accept, such as: myTable=someValue
![prototype javascript prototype javascript](https://miro.medium.com/max/922/1*OgeV095EQiZ5hSZiRNN8zw.png)
This also explains why it's possible to refer to the same property either directly or as a string: var spacing = myTable.cellSpacing įor the curious, this feature of JS is possible because the language is evaluated at run-time, and because all Objects are implemented as hash tables. In JavaScript, objects can have properties dynamically added to them.