Very new to javascript
Here is the portion of code of interest
var labels = {
'Test Catalog ID':id,
// 'Performing Laboratory': data['lab_name'],
// 'Biosafety': data['biosafety'],
'Tests Included in Panel': data['tc_tests_included'],
'Methodology': data['methodology'],
// 'Reference Range': data['ref_range'],
// 'Tests Limitations': data['limitations'],
'Preferred Specimens': data['analytes'],
// 'Rejection Criteria': data['rejection_criteria'],
'WARNING': data['warning'],
'Special Instructions': data['special'],
'Collection Instructions': data['collection'],
'Specimen Volume': data['specimen_volume'],
'Storage Prior to Shipping': data['storage_information']
}
console.log(Object.keys(labels));
output = Object.keys(labels).map(function(e) {
return labels[e]
})
console.log(output);
//console.log(Object.values(labels));
var new_HTML = '';
for(var i = 0; i < Object.keys(labels).length; i++){
if(Object.values(labels)[i] != 'N/A'){
new_HTML += "<strong>" + Object.keys(labels)[i] + "</strong>: " + Object.values(labels)[i] + "<br /><hr>";
}
}
body.innerHTML = new_HTML;
console.log(new_HTML);
In internet explorer I realized that Object.values was throwing an error and the recommended fix was to use Object.keys(labels).map(function(e) {
return labels[e]
})
But now I get SCRIPT5042: Variable undefined in strict mode
And I also do not know how to replace the Object.values in
if(Object.values(labels)[i] != 'N/A'){
new_HTML += "<strong>" + Object.keys(labels)[i] + "</strong>: " + Object.values(labels)[i] + "<br /><hr>";