Skip to content
This repository was archived by the owner on Oct 26, 2020. It is now read-only.

Js/ week3/ali haider #97

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
F-array-forEach exercise completed
  • Loading branch information
AliHaider-1 committed Jul 18, 2020
commit 50a7424ab83232cf832f9782f9fa1013032de613
16 changes: 16 additions & 0 deletions week-3/1-exercises/F-array-forEach/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,23 @@
*/

var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];

var names = ["Daniel", "mozafar", "irina"];
arr.forEach(function (name, index) {
if (name % 3 === 0 && name % 5 === 0) {
console.log(name + ": " + "FizzBuzz");
}
else if (name % 5 === 0) {
console.log(name + ": " + "Buzz");
}
else if (name % 3 === 0) {
console.log(name + ": " + "Fizz");
}
else {
console.log(name + ": " + name);
}

});
/* EXPECTED OUTPUT */

/*
Expand Down