Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Ejemplo JS para devolver una excepción.
function printError(message) {
throw new Error(message);
function validatePlayers(n) {
if (isNaN(n)) {
var message = "BooGame: Ingresa un valor númerico para la cantidad de jugadores.";
return true;
function start(n) {
if (validatePlayers(n)) {
console.log("BooGame: Cargando....");
//Devuelve error
//Forma correcta: start(2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment