How to get all the numbers in a range that multiples of 3 and 5 in JavaScript

1 Answer

0 votes
const from = 3 * 5;
const to = 300;

for (let i = from; i <= to; i++) {     
	if (i % 3 === 0 && i % 5 === 0)
    	console.log(i);
} 
 
 
 
/*
run:
 
15
30
45
60
75
90
105
120
135
150
165
180
195
210
225
240
255
270
285
300
 
*/

 



answered Jul 28, 2022 by avibootz
...