I am creating circles as a hobby, using a function to generate them. However, I am facing an issue with changing their parameters in the console after creation. Specifically, I am unable to change them in this manner and I'm wondering why not.
a.fill = "black";
does not successfully update the circle object's parameter when executed in the console.
const container = document.body
let svgContainer = document.createElementNS("http://www.w3.org/2000/svg", "svg");
svgContainer.style.width = "100vw"
svgContainer.style.height = "100vw"
svgContainer.setAttribute("viewBox", "0 0 500 750");
container.appendChild(svgContainer);
function makeCircle(cx, cy, r, fill, stroke, id) {
this.cx = cx;
this.cy = cy;
this.r = r;
this.fill = fill;
this.stroke = stroke;
this.id = id;
let newCircle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
newCircle.setAttribute("cx", cx);
newCircle.setAttribute("cy", cy);
newCircle.setAttribute("r", r);
newCircle.setAttributeNS(null, 'fill', fill);
newCircle.setAttributeNS(null, 'stroke', stroke);
svgContainer.appendChild(newCircle);
}
let a = new makeCircle(50, 300, 20, '#493fea', 'green');