I have a config.json file:
{
"test": {
"maths": [
"core",
"core2"
]
}
}
In my index.js, I want to access the object 'test', and iterate through each of the maths elements.
I am new to arrays, so still trying to figure out how they work. What is wrong with this approach? (I know it does not work)
var CONFIG = require('./config.json')
var fn = CONFIG.test.maths
fn.forEach(function(value){
console.log(value);
});
Also, what is the correct way of doing this?