Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6117435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:19:13+00:00 2026-05-23T15:19:13+00:00

The one thing I don’t like about javascript is that there are hundreds of

  • 0

The one thing I don’t like about javascript is that there are hundreds of ways to do things. What I want to know, is how do I declare a class? Do I use the function() approach? Do I call Class.create()? What is ‘standard practice’? What is ‘standard practice’ to declare member functions? Do I use a prototype? Do I use myClass.method()? And lastly, how do I do basic parent-child inheritance? The reason I am asking is because on the internet I have received many ways to do these things. I want to know what is ‘standard practice’.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:19:14+00:00Added an answer on May 23, 2026 at 3:19 pm

    The reason there is no “standard practice” for declaring classes and particularly subclasses in Javascript is that Javascript doesn’t actually have built-in syntactical language support for the typical classes one would find in C++. Instead, it has it’s own bag of tricks for how you generate similar functionality and there are lots of different ways to express those tricks. There really is no standard way.

    I find it best to use one of the more common javascript libraries (jQuery, Prototype, YUI, Closure, etc…) and then use the functions they provide for sub-classing which will give you your own “standard” way of doing it. If you don’t want to use one of the libraries, they you’ll need to borrow some code for sub-classing (the equivalent of YUI’s extend() function) from somewhere and then decide what style you want to use.

    I personally think it’s a weakness of Javascript in larger projects, projects with multiple people working on them or projects meant to be extended by others that there’s no language syntax for “the way” to declare classes and sub-classes. Instead, the only way to have a consistent code-base is to decide upon your own what style of declaration you’re going to use and then enforce that as a coding standard in the project, much as one would do with brace style or indent style.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.