This code was written according to tutorial advanced_objets_in_JS