This is helpful in a variety of situations, particularly with preventing inadvertent changes to an object's structure throughout a codebase, while still allowing for updates.
[0:15] In our application we only want to handle these four coin types. We want to make sure no new properties get added, and we want to make sure none of these get deleted.
[0:34] You might think this const declaration could help us here, but as we saw, const does not protect the contents of our object itself. All it does it keeps us from really assigning coins to an entirely new object or value. If we try to do something like this, we'll get a TypeError: Assignment to a constant variable.
[1:04] If we pass our coins object into Object.seal, save and take a look at the output, we'll notice we have the original properties that we had when we started. These update operations took effect, but our newCoin and our deleting of quarters did not take effect.
[1:21] In fact, if we were to enable strict mode on this file, save and take a look, we get a TypeError if we try to do an invalid operation after the object has been sealed.
[1:34] Object.seal is a great way to take an object, still allow updates to its existing properties, but not to allow any new properties to be added, and not allow anything to be deleted.