JSFiddle - React, Tailwind, and code Playground
by NAlexPear
HTML
<p>
Write a small program that prints every number from 1 through 100.<br />
If the number is divisible by 3, print "Five" instead of the number.<br />
If the number is divisible by 5, print "Star" instead of the number.<br />
If the number is divisible by both 3 and 5, print "Five-Star" instead of the number.
</p>
<p>
Example output (first 20 numbers):
</p>
<textarea rows="25" cols="75" id="output-area"></textarea>
CSS
textarea{
width: 750px;
height: 350px;
}
JavaScript
var sampleOutput = "";
for(var i = 1; i <= 100; i++){
if(i % 15 === 0){
sampleOutput += 'Five-Star\n'
} else if (i % 5 ===)
sampleOutput += i +'\n';
};
document.getElementById( 'output-area' ).value = sampleOutput;