What is the purpose of the static method in this class?
class Person {
constructor(name) {
this.name = name;
}
static create(name) {
return new Person(name);
}
}
Static methods in ES6 classes: 1) Are called on the class itself, not on instances, 2) Provide utility functions related to the class, 3) Cannot access instance properties or methods (no 'this' binding to instances), 4) Often used for factory methods, as shown in the example, 5) Help organize code that conceptually belongs to the class but doesn't operate on instances, 6) Are accessible through the class name (Person.create()) rather than instances.