UNPKG

castelog

Version:

Programación JavaScript en castellano.

11 lines • 673 B
const objectoPorDefecto = {}; const listaPorDefecto = []; const x = function(id, opciones, ...otros) {if(!(typeof id === 'string')) throw new Error("Error en [136-166=5:5-5:35] cuando: " + "Compruebo que id es tipo texto") if(!(Array.isArray(opciones))) throw new Error("Error en [167-208=5:36-6:41] cuando: " + "Compruebo que opciones es tipo lista") const resultado = {...(objectoPorDefecto), ...(opciones)}; const lista = [resultado, ...(listaPorDefecto), ...(otros)]; return resultado;}; let y = 0; try {{throw new Error("Un mensaje");}} catch(error) { y = 1;} if(!(y === 1)) throw new Error("Error en [501-533=13:81-15:31] cuando: " + "Compruebo que y es igual que 1")