# Factory Function doesn't update output?

**URL:** <https://forum.codewithmosh.com/t/factory-function-doesnt-update-output/5615>\
**Category:** JavaScript\
**Created:** [June 20, 2021, 12:38am UTC](https://forum.codewithmosh.com/t/factory-function-doesnt-update-output/5615 "2021-06-20T00:38:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![llennardd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/llennardd/32/1797_2.png) [@llennardd](https://forum.codewithmosh.com/u/llennardd)\
**Post date:** [June 20, 2021, 12:38am UTC](https://forum.codewithmosh.com/t/factory-function-doesnt-update-output/5615/1 "2021-06-20T00:38:48Z")

</div>

Hi, I’m new to JS and coding in general. Trying to get a better grasp of objects and factory functions. Can someone help explain why the factory function below doesn’t update the output when a property is changed?

```auto
//this is a factory function. it is a function that returns a new object
function circleArea(radius = 10) {
    return {
        radius: radius,
        get area(){
            return radius ** 2 * Math.PI;
        },
    };
};

// this is an object made from Factory function 
const a = circleArea(12);
console.log(a); 

a.radius = 10;
console.log(a.area);
//this function doesn't update the area when radius is changed

```

---

<div class="post-metadata">

**Author:** ![Augustine\_Awuori](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/augustine_awuori/32/873_2.png) [@Augustine\_Awuori](https://forum.codewithmosh.com/u/Augustine_Awuori)\
**Post date:** [June 21, 2021, 4:07am UTC](https://forum.codewithmosh.com/t/factory-function-doesnt-update-output/5615/2 "2021-06-21T04:07:59Z")

</div>

You’ve just modified it’s radius, and I think the whole func hasn’t been called fully to update what is dependent of radius.  
The best way is to const circle1 = circleArea(10);
