Yeah, delete is the standard way to go, but there are a couple things to keep in mind. delete userProfile.tempToken works great for regular properties, but it can slow things down if you’re working with objects that need to keep their “shape” for JS engine optimizations. You could also use destructuring if you want a new object without that property: const {tempToken, ...cleanProfile} = userProfile. This keeps your original object untouched and gives you a clean copy. For what you’re doing though, just use the delete operator - it’s straightforward and has solid browser support.
The delete operator is your best bet here. I’ve used delete userProfile.tempToken for years - works perfectly across all browsers. Quick tip the others missed: delete returns a boolean. You’ll get true if the property was deleted or didn’t exist, false if it couldn’t be deleted (non-configurable properties). With regular object properties like yours, it returns true and wipes the property from memory. Just remember delete won’t work on variables declared with var, let, or const - only object properties. For what you’re doing, delete userProfile.tempToken is exactly right.