I need to make my custom error. If the arguments are not numbers and if the arguments alength are more or less than two, then an error occurs.
class Point {
constructor(x, y) {
this.x = x;
this.y = y;
this.isNum();
}
isNum() {
if(typeof this.x !== 'number' || typeof this.y !== 'number' ) {
throw new Error('point is not a number ')
}
console.log(arguments.length)
}
}
try{
let example = new Point(1,2)
} catch(e){
console.error(e)
}
console.log(example.arguments.length)
How do I know the length of the arguments?
Is this spelling wrong?
If you can show how to solve correctly?
I apologize if I crookedly wrote a question.