I have a list:
var lt = {
  "part1" : "p1",
  "part2" : "p2",
  . (another key/value)
  . (another key/value)
  . (another key/value)
  . (another key/value)
}
and a variable
var myVar = "part2";
I want if myVar equal to the lt I want the variable z take the value p2 of lt. I have this:
for (var i = 0; i < lt.length; i++) {
    if (myVar === lt[i]) {
      z = lt.[i]
    }
}
However when I test it chrome console the var lt return undifined
 
     
    