Sine Wave for Node.js
Many years ago there was a program titled "SineWave" in a BASIC Language computer games book that I found entertaining. Here is a version of that program for Node.js.
var SPACES52 = " ";
var n = 0.0;
function tick() {
var a = Math.trunc((26 + 25 * Math.sin(n)));
var time = new Date();
var h = time.getHours();
var m = time.getMinutes();
var s = time.getSeconds();
var t = "";
if (h < 10) {
t += "0";
}
t += h + ":";
if (m < 10) {
t += "0";
}
t += m + ":";
if (s < 10) {
t += "0";
}
t += s;
console.log(SPACES52.substr(1, a) + t);
n += 0.25;
setTimeout(tick, 1000);
}
setTimeout(tick, 1000);