They gave the task, solved (sort of like) in a couple of lines of code.
The condition is:
By means of modular programming to solve the problem of processing a one-dimensional numeric array. Find the number of elements that are multiples of a given number and are not in the interval [a, b].
Solved the problem like this:
function calc(array, a, b, k){ for(var i = 0; i < array.length; i++){ if (array[i] < a || array[i] > b ){ if (array[i] % k == 0) { console.log(array[i]); } } } } calc([0,1,2,3,4,5,6,7,8,9], 3, 5, 2); But what does “modular programming means” mean in this case, and how, then, should this task be solved?