I’m looking to pass a string into a function and return the json object of that string name.
Objname is a string, such as “ky1”
function myFunction(objname) {
return myjsonobj.objname;
}
How can I get the above to parse correctly?
This is a simplified example, but demonstrates what I’m trying to achieve.
I’m not using jQuery, this is not an option for me in this piece of work.
Any help would be great, thanks!
try with
if you write that with dot notation you’re looking for a key named exactly “
objname” but in your example it is only a variable.