Lets say I create an arrow function for each element of a huge array
someHugeArray.forEach(record => {
const someValues = [...getAnotherHugeArray()]
const sum = _.sumBy(someValues, 'total')
record.getPrice = () => sum / record.quantity
})
it is just an example... so inside the environment, where getPrice is created, we have a huge array someValues, which we use, but actually for getPrice we don't need it any more as we got a required value and saved it to sum.
Is it helpful to destroy its value with code
someValues = null
or javascript engines are smart enough to not keep in memory values for function's lexical environment, which is not used by it?
