₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,951 members, 8,424,302 topics. Date: Thursday, 11 June 2026 at 12:12 AM

Toggle theme

Javascript Gurus Get In Here Biko - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingJavascript Gurus Get In Here Biko (432 Views)

1 Reply (Go Down)

Javascript Gurus Get In Here Biko by crunchyDope(op): 3:59pm On Sep 21, 2020
Question /Expectation

Lets say this is a json


config:
{
subconfig:
{
target :{

}

}
}


normally i would do

var value = json.config.subconfig.target;


buh how do i get it using a string
like so eval("json" + "config" + "subconfig" + "target"wink?

huh <i might be in the wrong prof>
Re: Javascript Gurus Get In Here Biko by Karleb(m): 5:20pm On Sep 21, 2020
Why would you want to do that?
Re: Javascript Gurus Get In Here Biko by crunchyDope(op): 6:59pm On Sep 21, 2020
Karleb:
Why would you want to do that?
because the json format might change and i want d code to adapt..huh

lets say d api is nested 3 levels and suddenly its 4 levels , how do i change d value seeing as d code is still doing ..

json[levelA][levelB][levelC]= "value"

now if the json is now under another object, the code would fail

huh
Re: Javascript Gurus Get In Here Biko by Karleb(m): 7:15pm On Sep 21, 2020
crunchyDope:
because the json format might change and i want d code to adapt..huh

lets say d api is nested 3 levels and suddenly its 4 levels , how do i change d value seeing as d code is still doing ..

json[levelA][levelB][levelC]= "value"

now if the json is now under another object, the code would fail

huh
Why would the configuration file change?

If I'm not mistaken, config file should be one of the easiest to set up.

Why not create a separate config file for the new changes?

What is stopping you from having a database.js, mail.js, session.js, cache.js, whatnot.js... Under a config directory?
Re: Javascript Gurus Get In Here Biko by crunchyDope(op): 7:19pm On Sep 21, 2020
Karleb:
Why would the configuration file change?

If I'm not mistaken, config file should be one of the easiest to set up.

Why not create a separate config file for the new changes?

What is stopping you from having a database.js, mail.js, session.js, cache.js, whatnot.js... Under a config directory?
too much js, too much to manage.
also m querying an api and i dont think its reliable
1 Reply

Please Help Me Answer This Pressing Question. Programming Gurus Get In HereNode Js Gurus @nswer This BikoMobile Technology: Lets Build A Mobile App With Javascript234

Who Has Paypal Account That Can PayI Need HelpProgramming