user475627
user475627

Reputation: 31

Is there a concept class in ExtJs framework?

According to my knowledge in javascript,there are objects and we can create objects for a function or we can create objects using literal notation..i never seen the concept of class in javascript.recently i have started to learn EXTJS(a javascript library)..in EXTJS people are saying like predefined classes(eg.EXt,Panel etc.) are there and even in api docs they are writing as class..it does not make sense to me..my questions are

1.why extjs people are using the word "CLASS"?

2.if class concept is there in extjs what way i have to think it?

3.is there a concept "CLASS" in js(i think no)?

Upvotes: 2

Views: 274

Answers (3)

Guffa
Guffa

Reputation: 700342

No, there are no classes in Javascript, but it supports some object oriented principles. You can make a function that you can use as constructor for an object:

function Point(x, y) {
  this.x = x;
  this.y = y;
}

By using the new keyword, the function will be used as a constructor:

var p = new Point(4, 5);

Using the prototype keyword you can add methods to the objects that are created with a specific function, which is similar to putting methods in a class.

Although this is actually not a class as far as the language is concerned, it walks and talks like a class, at least in some aspects. It's useful to use the term class when describing how it's intended to be used, even if it's actually not a class.

Upvotes: 0

dmarucco
dmarucco

Reputation: 590

Everything in JavaScript acts like an object (JavaScript is a prototype-based, object-oriented scripting language) with the only two exceptions being null and undefined. Even functions are objects (Actually, this is why JavaScript is said to have first-class-functions)

For ExtJS, "class" is a virtual concept: that is a conceptual extension created by the authors of the framework (relying on JavaScript way to declare classes)

Upvotes: 2

Aaron
Aaron

Reputation: 1342

Try reading this..

http://www.phpied.com/3-ways-to-define-a-javascript-class/

Upvotes: 0

Related Questions