• Your issue is you're not defining name locally, so it's a global variable and just ends up filled with the last value you set it to. If you change:

    data = getDataStreams();
        Object.keys(data).forEach(function(k){
          name = data[k].description.split(" / ")[0];
    

    to

    data = getDataStreams();
        Object.keys(data).forEach(function(k){
          var  name = data[k].description.split(" / ")[0];
    

    Then name ends up defined locally in the function defined inside forEach, so each key in data has its own version of name set.

About

Avatar for user156125 @user156125 started