script.js:added call to foreach