Completing my first WOD (Workout of the Day) in the ICS 314 class was like stepping into a thrilling coding adventure. As I stared at lines of code, excitement and fear coursed through me simultaneously. The challenge was to navigate through complex logic and deliver a solution under a ticking clock.
Here’s the JavaScript code for the challenge:
function name() {
for (let i = 0; i < 100; i++) {
if ((i % 6 == 0) && (i % 4 == 0)) {
console.log("Bert");
} else if (i % 6 == 0) {
console.log("Ernie");
} else if (i % 4 == 0) {
console.log("BertErnie");
}
console.log(i.toString());
}
}
name();