const alphabets= {
first: ["a", "b", "c"],
second: ["d", "e", "f"],
third: ["g", "h"]
};
function trial(arr) {
for (let i = 0; i < arr.length; i++) {
const argh = `<li class = "text-warning">${i}<li>`;
return argh;
}
};
console.log(trial(alphabets.second));
I've tried the same 'for loop' outside the function replacing condition with a number and it works fine. Why is it only looping once when put in the function and using the parameter in the condition?