Define Class in Javascript

A Class in Javascript  is  a function javascript definition of class in a  little  different  to  c#  and java.however  ES6   offered classes to the js
For defining  class in ES6 we  have  to use  The Class  Keywords  that were introduced  by  ES6.
you should  know  the definition of class in   TypeScript     will be converted  to a function again.
it means definition of  a class  will be a function .similar to legacy  definition in the javascript
so it  worth to learn how to define a class

  function programer(lng) {
            this.lng = lng;
       function human(name, family, age) {

   = name;
   = family;
            this.age = age;
        human.prototype.setNameFamily = function () { alert( + " " + }
        var myInstance = new human("bahman", "rashidi", "35");
        var MyprogrameIns = new programer("Js");

i have created a class named  the human and  another  named  programer.actually  each calss  in a The ES6 you can use the Class Keywork  for defining a class but finaly  it  will be converted  to a function .

In my sample , the human and the programer functions will generate a class fo us.

for exmaple

var myInstance = new human("bahman", "rashidi", "35");

The human is  a function that after calling  it , we will have  a class  with  3 properties .All  data  has been passed  to the constructor.
for example the will  give  us  the "bahman value"
the human.prototype.setNameFamily will  add  a function to the human class.By using  Object.getPrototypeOf()   of an object ,  we  can add  function to  an existing class.
defining  a class in javascript  is  very easy .
in the  future  , i am going  to show  you how  to define classes in TypeScript.

 hope you find this article is helpful