2020年12月19日星期六

Iterating through an array and returning parameters

I'm iterating through an array that was created from constant. I am then performing some math on some of the values but seem to not be able to get them to display. I'm sure it is something relatively minor I am missing. I am just posting the code I am having trouble with but can post more if need be.

bitValue = document.getElementById("displayBits").value;    const selectedBit = selectedBits.find(bit => bit.name === bitValue);    var hardness;  var passDepth;  var numPass;  var feedRate;  var rpmBit;    for (var i = 0; i < selectedBit.length; i++) {      if (selectedBit.rpm <= rpmValue) {          rpmBit = rpmValue;      }        else { rpmBit = selectedBit.rpm }        if (material.soft === true) {          hardness = selectedBit.soft;      }        else { hardness = selectedBit.soft }        if (selectedBit.ced <= thicknessValue) {          passDepth = (Math.round(thicknessValue) / (Math.ceil(thicknessValue)) / selectedBit.ced);          passDepth = (passDepth / selectedBit.flutes);      }        else {          passDepth = selectedBit.ced;      }        numPass = (thicknessValue / passDepth);        feedRate = (selectedBit.flutes * rpmBit * hardness);  }    console.log(selectedBit.name + numPass + feedRate + rpmValue + passDepth);  


from Recent Questions - Stack Overflow https://stackoverflow.com/questions/65376698/iterating-through-an-array-and-returning-parameters Nikolai Mikkelsen http://ifttt.com/images/no_image_card.png

没有评论:

发表评论