Forum Discussion

fmendes's avatar
fmendes
Contributor
14 years ago

Javascript Classes

Is it possible to create Javascript classes? If so, how? I have tried to create on a script file and didn't work. Thanks in advance!

4 Replies

  • Just remember that your script files cannot be the exact same name as the objects defined in them, or TestComplete gets really confused.
  • Javascript doesn't create classes like Java or C#, it has a different inheritance model. I struggled with this for quite some time. I posted a sample project at the end of the issue "New behavior for JScript Object prototype property".



    I also suggest the W3C schools website for learning the general principles of JScript: www.w3schools.com/js/

    Once you get a feel for that, Douglas Crockford is THE guy for JavaScript: www.crockford.com



    Good luck, the prototypal inheritance model is a little weird, but now that I'm starting to understand it, I like it.



    Dave
  • Thanks, actually I did exactly what you did on the begining, via prototypes, and received the same errors. I will try the work arround. And thanks for the code you provided.