Linear Complexity*

In functions or algorithms with linear complexity, a single unit increase in the input causes a unit increase in the steps required to complete the program execution.
A function that calculates the cubes of all elements in a list has a linear complexity. This is because as the input (the list) grows, it will need to do one unit
more work per item. Look at the following script.
xxxxxxxxxx
10
function displayAllCubes(items) {
for (let item of items) {
const result = Math.pow(item, 3);
console.log(result);
}
}
const inputs = [2, 3, 4, 5, 6, 7];
displayAllCubes(inputs);
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment