Consider an object from which we want to retrive properties. const obj = { earth: { level: { one: 'soft mud and rocks' } }, vibrations: [1, 2, { range: 'medium' }], }; Use [...].map() for each selector, "vibrations[2].range".replace() to replace square brackets with dots. Use "earth.level.one".split('.') to split each selector. Use [...].filter() to remove […]
The post How to get properties indicated by given selectors from an object? appeared first on Geekstrick.