1. Factory function: a function that returns an object
2. Advanced factory function: a factory function whose parameters are callback functions and factory functions
3. Examples:
<script>
function superFunc(factory){
return (...arguments)=>{
console.log(...arguments)
const instance=factory(...arguments)
const time=new Date()
return {
time,
instance
}
}
}
let createOrder=superFunc(function(ingredients){
return {
type:"order",
ingredients
}
})
console.log(createOrder('text'))
</script>