JSFiddle - React, Tailwind, and code Playground

by gkucmierz

JavaScript

let runTests = (function() {
	let random = Math.random;

	return function() {
  	console.log('here in tests we can use real Math.random', random());
  };
}());

let runUserCode = function() {
	// user is trying to broke Math.random here:
  Math.random = () => 0;
};

runUserCode();
runTests();