Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is "class.create" part of standard JavaScript?

Tags:

javascript

I saw this code inside a web application and wanted to understand it better (so as to be able to create this sort of structures myself), but I am not sure what kind of JavaScript this is.

What I mean is, is the Class.create() syntax part of "out of the box" JavaScript or part of some library that is embedded in this web application?

enter image description here

like image 817
x457812 Avatar asked Mar 05 '15 22:03

x457812


People also ask

What is class create in JavaScript?

Class methods are created with the same syntax as object methods. Use the keyword class to create a class. Always add a constructor() method. Then add any number of methods.

Is class available in JavaScript?

JavaScript ECMAScript 5, does not have class type. So it does not support full object oriented programming concept as other languages like Java or C#. However, you can create a function in such a way so that it will act as a class.

Why do we create class in JavaScript?

Classes are a template for creating objects. They encapsulate data with code to work on that data. Classes in JS are built on prototypes but also have some syntax and semantics that are not shared with ES5 class-like semantics.

Is class A type in JavaScript?

A JavaScript class is a type of function. Classes are declared with the class keyword. We will use function expression syntax to initialize a function and class expression syntax to initialize a class. We can access the [[Prototype]] of an object using the Object.


1 Answers

Class (as in window.Class) is not part of the JavaScript standard. Thus any method on it, including Class.create, is not part of standard JavaScript.

Open up a vanilla console and do: typeof Class.

The result is "undefined".


There exists Prototype and other "Class" variations - see which library is loaded.

like image 71
user2864740 Avatar answered Sep 29 '22 20:09

user2864740