I want to get two values out from the function for a specific condition (on "As_cm" values) and execute some operation on those values. I could not do that.
function steelSection() {
if (As_cm <= 29.2) {
return [D = 152.4, B = 152.2];
} else if (As_cm <= 38.3) {
return {D = 157.6, B = 152.9];
} else {
return [D = 1000, B = 2000];
}
}
var d = D / 2;
var b = B / 2;
console.log(d);
document.getElementById("flangeWidth").innerHTML = d ;
console.log(b);
document.getElementById("depth").innerHTML = b ;
expected values for As_cm <= 29.2
d= 152.4 / 2
b= 152.2 / 2
The error message I get is
Uncaught TypeError: Cannot set property 'innerHTML' of null
at steelcolumn.js:68