Advance objects - Factory Functions

Hello all,

I don´t understand what is the the reason of creating the ‘beep’ function in the robotFactory factory function exercise.

I understand that factory function are useful to create objects that have the same properties, but may have different values. But, what is the reason for creating the function and calling it?

Thanks in advance. Link for the exercise below;

https://www.codecademy.com/courses/introduction-to-javascript/lessons/advanced-objects/exercises/factory-functions

This exercise is a showcase of what can be done with factory functions.

You may want multiple copies of an object with perhaps different values to keys but with the same common function assigned to it.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.