Course: https://www.educative.io/collection/10370001/5862304337887232
Lesson: https://www.educative.io/collection/page/10370001/5862304337887232/6184140229574656
In the example given by the educative team inside the constructor
function are used commas, looking at MDN I see they use semicolons.
I thought that using commas should generate a syntax error but it doesn’t. Could anyone explain how using commas is a correct syntax? Here is the example code
class Shape{
constructor(name,sides,length){
this.name = name, // shouldn't this comma be a ; ???
this.sides = sides,
this.length = length
}
static displayName() {
return this.name
}
}
// .... omitted