I have an object that looks like this:
var serviceData = {};
serviceData.energy = {commission:15.00, retention:0.00, conversion:0.099, renewal: false, offset:0, rental: true}
serviceData.homeMedia = {commission:20.00, retention:0.00, conversion:0.02, renewal: false, offset:0, rental: true}
serviceData.removal = {commission:4.00, retention:0.00, conversion:0.05, renewal: false, offset:2, rental: true}
serviceData.storage = {commission:6.00, retention:0.09, conversion:0.01, renewal: true, offset:2, rental: true}
serviceData.homeContents = {commission:50.00, retention:0.55, conversion:0.40, renewal: true, offset:0, rental: false}
I want to loop over the serviceData and if an item's property rental is false I want to remove that item from serviceData without actually modifying the serviceData object. In other words, create a new object minus the 'removed' item.
How can I do this???
delete...delete serviceData.homeContents;