Created
March 31, 2015 19:37
-
-
Save francolaiuppa/5556616ccbc76056cd1d to your computer and use it in GitHub Desktop.
hackealo.co solucionador. SPOILER: Aunque pongas la respuesta correcta no funciona
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
// "acb" es (1*1) + (2*3) + (3*2). | |
var letters = ['a','b','c','d','e','f','g','h','i','j','k','l', | |
'm','n','o','p','q','r','s','t','u','v','w','y','x','z', | |
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', | |
'Q','R','S','T','U','V','W','Y','X','Z']; | |
// var word = 'HZyVYIW'.toLowerCase().split(''); | |
var word = 'HZyVYIW'.split(''); | |
var total = 0; | |
var msg = ''; | |
word.forEach(function(letter,index){ | |
msg = ((index+1)+' * '+parseInt(letters.indexOf(letter)+1)); | |
console.log(msg); | |
total += (index+1)*(parseInt(letters.indexOf(letter)+1)); | |
}); | |
console.log(total); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment