Explica este c贸digo JavaScript
Dificultad: B谩sico
驴Cu谩l es la manera correcta de llamar a un setter?
class Dog {
#peso;
constructor({ color, tamanio, peso=10, cola=true}){
this.color = color;
this.tamanio = tamanio;
this.#peso = peso;
this.cola = cola;
}
set setColor(nuevoColor){
this.color = nuevoColor;
}
}
const boby = new Dog({
color: "cafe",
tamanio: "grande"
});
console.log(boby.color); //cafe
boby.setColor("rojo"); //A
boby.setColor = "rojo"; //B
A. A
B. B
C. Ninguna de las anteriores
Respuesta en el primer comentario.