Skip to content
Advertisement

Grabbing nested variable depending on object name

I have an object formatted like so

JavaScript

and given a String parameter like punch or kick, I want to grab its corresponding force. What’s the best way to implement this?

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement