Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,161,448 members, 7,846,864 topics. Date: Saturday, 01 June 2024 at 04:39 AM

Javascript Gurus Get In Here Biko - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Javascript Gurus Get In Here Biko (321 Views)

Please Help Me Answer This Pressing Question. Programming Gurus Get In Here / Node Js Gurus @nswer This Biko / Easyphp Devserver Gurus Get In Here (2) (3) (4)

(1) (Reply) (Go Down)

Javascript Gurus Get In Here Biko by crunchyDope(m): 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?

<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(m): 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..

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

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..

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


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(m): 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 Anyone Who Has Data Science Or Machine Learning Textbooks In Lagos / Free Web Hosting / Please Help! How Do New Websites Get Google Ads Displayed On Them

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.