Javascript: Tips and tricks
Query selector
This return first element which has class=”test” and changes its css display to none.
getElementById
This return element which has id=”test”. It is faster than querySelector.
Event listener
https://developer.mozilla.org/en-US/docs/Web/Events
or we can do the same with anonymous function (because this function will be used only in this one case)
Objects
Instantiation and inheritance
All methods which we want to be inherited, we put in prototype property. Putting it directly into Person object isnt good idea, because then each object will have this function, which isnt effective.