Here is a jsfiddle example showcasing the issue, but proceed with caution as it contains an infinite loop that can cause the browser tab to slow down and eventually freeze when the console is opened: https://jsfiddle.net/evx1j6yf/1/
Array Data:
days: [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday"
],
openingDays: []
Template Code:
{% for day in days %}
{[ formatDays(day) ]}
{% endfor %}
formatDays Function:
formatDays(day) {
message = translateDays(day);
openingDays.push(message);
}
Expected Behavior: The second array should contain a duplicate of the days from the first array.
Actual Outcome: Instead, there is an endless repetition after the last day without any breaks.
Console Output:
["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", ...