Write a function named "find_value" that takes a key-value store as a parameter with strings as keys and integers as values. The function returns a boolean representing true if the value 7 is in the input as a value, false otherwise. (My code below)
function find_value(key){
for (var i of Object.values(key)){
if (i == 7){
return true;
}
else{
return false;
}
}
}
When I call with the input [{'effort': 4, 'doctrine': 8, 'item': 11, 'behavioral': 7, 'occasional': 11}], I should get true, but I am getting false instead. What am I doing wrong?
return falseoutside the loop.returnbreaks the loop