By that logic JQuery users/devs were idiots for recreating the wheel. I smell a jqueery fanboi and it stinks to high heavens.
$('.tpm_sensors').forEach(function(sensor) { if (sensor.pressure < threshold) fixBeforeIDie(); });
vs:
var tpm_sensors = document.getElementsByClassName('tpm_sensors'); for (var i = 0, len = tpm_sensors.length; i < len; i++) { var sensor = tpm_sensors[i]; if (sensor.pressure < threshold) fixBeforeIDie(); }
And so it starts. jQuery uses .each, not .forEach. So you fix that. But stuff still doesn't work.
Right, because jQuery's .each passes the index as first parameter and the element as second (or this).
jQuery trips me every single time.