i am tying to implement basic inheritance, bellow is my min reproducible code, I want to call eat function in dev1 but It says that dev1 does not have eat function. i tried writing all oof it in HTML script tag
//parent class
function Person(name, location) {
this.name = name
this.location = location
}
// parent class function
Person.prototype.eat = function () {
document.write("i like sea food ")
}
//child class
function Developer(name, location, projects) {
Person.call(this, name, location)
this.projects = projects
}
// object
var dev1 = new Developer("abc", "xyz", ["aa", "bb"])
dev1.eat()