JSFiddle - React, Tailwind, and code Playground

by gutek

JavaScript

function slow() {
    return arguments[0];
}

function test () {
	var i;
	console.time('slow');

	for(i = 0; i < 10000000; i += 1) {
		slow(i);
	}

	console.timeEnd('slow');

	console.time('fast');

	for(i = 0; i < 10000000; i += 1) {
		fast(i);
	}

	console.timeEnd('fast');
}

function fast (arg) {
	return arg;
}

test ();