Answers for "concat keys json"

0

concat keys json

finalStr = ''
Object.keys(obj).forEach(function(key) {
  if (obj[key].name === 'mountpoints') { // only get sizes for mountpoints
    var value = obj[key].value;
    Object.keys(value).forEach(function(name) { // add all sizes to string
      finalStr += '"' + name + '" - ' + value[name].size + ';';
    }); //update
  }
}); //update

if (finalStr.length > 0) { // at least one entry was added
  finalStr.slice(0, -1);
}
Posted by: Guest on July-23-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language