-
-
Save parzibyte/e333c2aa704497d42fae659326a58e0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const tipoDeArgumento = argumento => { | |
// https://parzibyte.me/blog | |
const tipo = typeof argumento; | |
// Diccionario con equivalentes | |
const diccionario = { | |
"object": "objeto", | |
"boolean": "booleano", | |
"function": "función", | |
"number": "número", | |
"string": "cadena", | |
"undefined": "undefined", | |
}; | |
return diccionario[tipo]; | |
}; | |
const valores = ["Luis", 12312, {}, undefined, null, []]; | |
for (const variable of valores) { | |
const tipo = tipoDeArgumento(variable); | |
console.log(`El tipo de ${variable} es ${tipo}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment