I have a function returning null by default, and another value by condition.
var getName = function(boxid){
    var boxes = localStorage.getItem("boxes");
    if((boxes != "" )&& (typeof boxes != "undefined") &&( boxes != null))
    {
        boxes = JSON.parse(boxes);
        boxes.forEach(function(box){
            if(box.id == boxid)
            {
                console.log("box.name: "+ box.name+ " boxid: "+ box.id+ " : "+ boxid);
                return box.name;
            }
        });
    }
    return null;
};
the correct array-entry gets found. but the return statemant doesn't return it, it's ignored.
 
     
     
    