Create multiple vars from object keys

Let’s say you have an object that looks like this…

const object = {
    name: 'Ash',
    color: 'red',
    age: 100

And for some reason maybe you need to create some local variables within a function based on the values of the keys in that object. You can do that like this…

const { name, color, age } = object;

As long as each variable name you supply maps to the name of a key in the object, you’re good to go.