141k views
3 votes
Display the number sequence from 100 to 150 in the following format in event-driven JavaScript: a) 100, 101, 102, ... b) 100 - 101 - 102 - ... c) 100 > 101 > 102 > ... d) 100 | 101 | 102 | ...

1 Answer

4 votes

Final answer:

To display the number sequence from 100 to 150 in different formats in event-driven JavaScript, you can use loops and conditional statements to concatenate the numbers with the desired symbols.

Step-by-step explanation:

To display the number sequence from 100 to 150 in different formats using event-driven JavaScript, you can use loops and conditional statements. Here are examples of each format:

a) Using a comma:

let sequence = '';
for (let i = 100; i <= 150; i++) {
sequence += i + ', ';
}
console.log(sequence);

b) Using a hyphen:

let sequence = '';
for (let i = 100; i <= 150; i++) {
sequence += i + ' - ';
}
console.log(sequence);

User NoMoreZealots
by
7.9k points