• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Javascript best practices

 
Ranch Hand
Posts: 72
MySQL Database AngularJS Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks,
I am stuck while trying to implement classical pattern mainly to learn best practices in js. I am not able to understand why my call to inherit method fails? Any help is much appreciated. Sorry for any layman's mistake.
Below is program.



 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would argue (though there may be those would disagree with me) that what you are attempting to do here is far from a "best practice" in JavaScript. Trying to implement classical inheritance in JavaScript is not natural nor native to JavaScript. Just look how complex your code is to do something that's actually quite simple in concept.

I prefer to let JavaScript be JavaScript and not try to shoehorn unnatural concepts from other language into it.
 
reply
    Bookmark Topic Watch Topic
  • New Topic