JSFiddle - React, Tailwind, and code Playground

by velo_ninja

HTML

<script>
const CWlinks = ["CW001", "CW002", "CW003", "CW004", "CW005", "CW006", "CW007", "CW008", "CW009", "CW010"]

CrossWordNGSL = function () {
	// get a random number between 0 and the number of links
	let randIdx = Math.random() * CWlinks.length;
	// round it, so it can be used as array index
	randIdx = parseInt(randIdx, 10);
	// construct the link to be opened
	let CWlink = './Crossword/NGSL_' + CWlinks[randIdx] + '.html';
	// open it in a new window / tab (depends on browser setting)
	window.open(CWlink);
	};

</script>