Created
November 1, 2011 01:28
-
-
Save JuliaGabellone/1329599 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function comparar (numero , string){ | |
if (typeof(string)!= 'string' || typeof(numero)!='number'){ | |
return false | |
} | |
if (isNaN(string)){ | |
return false | |
} | |
if (numero == string){ | |
console.log("Iguales") | |
return true | |
} | |
var resto = numero%string; | |
if (resto == 0){ | |
console.log("Multiplo") | |
return true | |
} | |
else if (resto != 0){ | |
console.log("No-multiplo") | |
return true | |
} | |
} | |
comparar(34 , "2") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Crear una funcion:
Que:
valide los parametros, el primero debe ser numerico el segundo un string CON UN NUMERO ADENTRO (ej: "12345" es correcto, "12A" no, "asdf" tampoco).
comparar el 'numero' con el valor numérico del string.
2a) si son iguales imprimir en consola "IGUALES"
2b) si el 'string' es multiplo de 'numero' imprimir en consola "MULTIPLO"
2c) si no es multiplo imprimir en consola "NO-MULTIPLO"