JSFiddle - React, Tailwind, and code Playground

by PhilQ

JavaScript

function processInput() {
		return alert('Yep');
	}
	function alertBadInput() {
		return alert('Nope');
	}
	function askForInput() {
		return prompt('What?');
	}

	function getInput() {
		var no_valid_input = true;
		var input = null;
		while (no_valid_input) {
			input = askForInput();
			if (input !== 'bad') {
				no_valid_input = false;
			} else {
				alertBadInput();
			}
		}
		processInput();
	}
	getInput();