eclipse / paho.mqtt.javascript

paho.mqtt.javascript
Other
1.15k stars 467 forks source link

refactor: replace "for" loops with Array.prototype.* methods as appropriate #143

Open boneskull opened 6 years ago

boneskull commented 6 years ago

Using for loops (with the exception of for..of) in JS nowadays is discouraged. Generally, anything that can be expressed as a for loop can be better expressed declaratively using Array.prototype methods ("you need to iterate over an array--but you don't need to tell JS how to do so").

Replace for loops with Array.prototype methods such as forEach, map, etc., as appropriate.