JSFiddle - React, Tailwind, and code Playground
by AntonLapshin
HTML
<div id="result"></div>
JavaScript
var list1 = [28, 30, 36, 42, 45, 60, 80],
list2 = [120, 127],
list3 = [1.5, 1.3333332, 1.2631578, 1.2, 1.090909, 1.0434781, 1, 0.9230769, 0.8571427],
result = [],
result$ = $('#result'),
Q,
step;
list1.forEach(function(one){
list1.forEach(function(three){
list2.forEach(function(two_one){
list2.forEach(function(two_two){
list3.forEach(function(transmission, i){
Q = one / two_one;
step = (two_two / three * Q * transmission).toFixed(3);
result.push({ text: one + ' - ' + two_one + ' - ' + two_two + ' - ' + three + ' - ' + (i + 1), step: step });
});
});
});
});
});
result.sort(function(a, b){
return b.step - a.step;
//return a.step - b.step; // (чтобы отсортировать по возрастанию)
});
result.forEach(function(value){
result$.append(
$('<p></p>').html(
value.text + ' = ' + value.step
)
);
});