Suppose we have object like this:
foo = {
"currency": "dollar"
}
Is it possible to check if value of object exists and is equal to dollar?
For example:
const bar = currency;
So how can we pass the value of bar to foo path? Or use any syntax that should work as $bar? I don't want to pass $bar as a path name but a value of bar as a path.
foo.$bar? true: false
in result foo.currency === true or false
Or even is it possible to have another object like:
anotherobject.anotherpath.$(getKey(foo))
to get object like anotherobject.anotherpath.currency?
Hope it's clear enough to understand
foo[bar]? Like infoo[bar] == "dollar"?if (bar in foo && foo[bar] === 'dollar')wherebar = 'currency'developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…