I am dealing with a JavaScript class set up like this
class Student {
constructor(name, age) {}
}
I am looking for a way to throw an error message if one of the parameters (such as 'name') is not passed. For example:
if (!name) {
return "Oops, you forgot to provide a name"
}