0
Is there class defination in JavaSecript
6 Antworten
+ 3
Last versions of ECMA script ( on which is based JS ), introduce syntaxic sugar to handle more easily classes concept through protypage one of JS...
Unfortunally, this must be reserved for very specifics project, wich doesn't require cross-browser compatibility, as each doesn't implement these last features of JS ^^
Anyway, to dive deeper into that stuff: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
+ 2
Watch this video: https://www.youtube.com/watch?v=O8wwnhdkPE4&t=2524s . Maybe it help you.
And try other videos of this guy.
+ 2
I will see the video thank you
+ 1
In JavaScript there are no classes. Although the function to some extent fulfill their role.
For example:
function MyClass () {} ;
var myObject = new MyClass();
alert(myObject instanceof MyClass); // true
Try it.
+ 1
I repeat "In JavaScript there are no classes."
function MyClass () {} ; - you can think about it like it a class.
var myObject = new MyClass(); - we create object (instance of "class" MyClass).
alert(myObject instanceof MyClass); // true - check is myObject is instance of "class" MyClass.
It is a long conversation about classes and OOP in JS. Watch videos read articles and you inevitably understand this things.
0
please I want to understand how to use OOP with out class?
What is the way in java script to create class?