Factory & Constructor Functions

What is the primary benefit of this mixin factory pattern?
const withLogging = (target) => ({
  ...target,
  log(message) {
    console.log(`[${target.name}]: ${message}`);
  }
});

const withValidation = (target) => ({
  ...target,
  validate() {
    return typeof target.name === 'string';
  }
});

const createEntity = (name) => {
  const base = { name };
  return withValidation(withLogging(base));
};
Next Question (13/20)