How may I change an object with only its reference in Javascript?
var $obj = { original: true }
var $ref = $obj
// Is it possible here to set $obj to {} with only using $ref?
$ref = {} // This doesn't work
console.log($obj)
// => { original: true }
Example usage:
var $objs = {
a: {
wantsToBeAnEmptyObject: true
},
b: {
wantsToBeAnEmptyObject: true
}
}
_.forOwn($objs, (val) => {
val = {}
})
Can anyone help me with this problem?