Lab 5
Lab 5
Lab # 5
INTERMEDIATE JAVASCRIPT
OBJECTIVE: To get familiar and become more knowledgeable in implementing real world JS
use cases.
LAB TASK
SOURCE CODE:
JS CODE
class Student {
constructor(id,name,dob) {
this.id=id;
this.name=name;
this.dob=dob;
}
enroll() {
console.log('${this.name} has been enrolled successfully!');
}
}
// MAHAM IMRAN (2020F-BSE-111)
import {Student} from './student.js;'
class RegularStudent extends Student {
constructor(id,name,dob) {
super(id,name,dob);
}
attendLab() {
console.log('${this.name} is attending lab.');
}
}
Page | 1
NAME: Maham Imran
ROLL NO: 2020F-BSE-111.
export {Exceutivestudent};
//MAHAM IMRAN (2020F-BSE-111)
class ExecutiveStudent extends Student {
constructor(id,name,dob) {
super(id,name,dob);
}
attendTheory() {
console.log('${this.name} is attending theory.');
}};
module.exports= {Student, RegularStudent, ExecutiveStudent};
module.exports = {fetchAboutPage};
OUTPUT:
Page | 4
NAME: Maham Imran
ROLL NO: 2020F-BSE-111.
HOME TASK
SOURCE CODE:
class course{
constructor(id, name, creditHours){ this.id = id,
this.name = name, this.creditHours = creditHours
}
}
//MAHAM IMRAN 2020F-SE-111
export default Course
Page | 6
NAME: Maham Imran
ROLL NO: 2020F-BSE-111.
OUTPUT:
Page | 7