This is only mere example. However the basis of what I am doing is running through a loop where one of the objects in the loop can have one of the below objects what I want to do is find in said object below if there is a match to the object I am looping through where if there is a match I want to use the use the object below matching value.
prettyNames = {
"namenode": "Name Nodes",
"secondarynamenode":"Secondary Name Nodes",
"datanode":"Data Nodes",
"web":"Web",
"tasktracker":"Task Trackers",
"jobtracker":"Job Trackers",
"oozie":"Oozie",
"single-namenode":"Single NameNode",
"single-databse":"Single Database"
};
So with that I know how to do it with PHP and I thought I knew how I could it with javascript. However Its not working as well as I thought so I am looking for ideas how to handle it properly.
Edit What I have is an JSON object I am iterating through via a for each style loop. Where one of the objects within that JSON is a more like an ID from the system output. What I want to do is while running through that loop take that object as a variable and compare it to the variables/objects in the prettyNames object so if its found in prettyNames it will use that value instead of the default system output. Ultimately I am also trying to avoid having eventually dozens of nested if statements to do the same thing