JSFiddle - React, Tailwind, and code Playground

by Cath_kb

JavaScript

function distance(x1,y1,x2,y2){
    var dx = x2-x1;
    var dy = y2-y1;
    return Math.sqrt(dx*dx+dy*dy);
}

function printprops(o) {
    for (var p in o)
    console.log(p+": "+o[p]+"\n");
}

var fact = function(a) {
    if (a <=1) {return 1} else {
    return a*fact(a-1);
}
};

var fact = function(a) {
    var total = a;
    if (a <=1) {return total} else {
    	total *= fact(a-1);
	}
	return total;
};

(function repeat() {
    console.log(1);
    setTimeout(repeat,1000);
})()