TIL a fancy word for auto-generating objects, A Factory Function
POSTED ON:
TAGS: programming patterns
So a factory function creates objects.
something like
function makeNewMage(theName) {
const newMage = {
name: theName,
magic: 100,
spell: 'fireball';
}
return newMage;
};
const JakeTheMage = makeNewMage('Jake')
const SarahtheMage = makeNewMage('Sarah')
There's no real magic to it.
Related TILs
Tagged: programming