I am working with the following structure:
const config = { modules: [ { debug: true }, { test: false } ] }
My goal is to create a function that can provide the status of a specific module. For example:
getStatus("debug")
While I can access the array using config["modules"]
, how can I retrieve the value of a particular key within the nested objects?
config["modules"][0]
would return debug: true
,
and config["modules"][1]
would return test: false
What is the best way to locate a key within a numbered index?