I\'m having trouble looping through an object and changing all the values to something else, let\'s say I want to change all the values to the string \"redacted\". I need to
You can also go functional.
Using Object.keys is better as you will only go through the object properties and not it's prototype chain.
Object.keys
Object.keys(spy).reduce((acc, key) => {acc[key] = 'redacted'; return acc; }, {})