DEV Community

Aashish Panchal
Aashish Panchal

Posted on

Classes Basic

class Student {

constructor(firstName, lastName, year){

    this.firstName = firstName;

    this.lastName = lastName;

    this.grade = year;

    this.tradies = 0;

    this.scors = [2000, 200]

}

fullName(){ 

        console.log(`Your Full Name is ${this.firstName} ${this.lastName}`);

        console.log("<------- AND ------->");

        console.log(`Your's Age is ${this.grade} Years old`)

        console.log("<------- AND ------->");

}

markLate(){

    this.tradies += 1;

    console.log(`👉👉👉   Your Tradies ${this.tradies} Time Used...`);

    if(this.tradies >= 4){

        return ` 😲😲 Oh... ${this.firstName} Your Tradies are Expire...!!! 😲😲`

        console.log(` Your Tradies ${this.tradies} Time Used...`);

    }

}

addScors(scors){

    console.log(`${ this.scors}`)

}

calculateAverage(){

    let sum = this.scors.reduce(function(a,b){console.log("Answre is ", a+b)})

}

static enrollStudents(){

    console.log("ENROLLING STUDENT...!!!")

}
Enter fullscreen mode Exit fullscreen mode

}

let firstStudent = new Student("Your name ", "Your surname ", "Your year" );

firstStudent.fullName();

firstStudent.markLate();

firstStudent.addScors();

firstStudent.calculateAverage();

Top comments (0)