Enviando proyecto valid-Credit-Card#56
Open
Jennifercarmen wants to merge 2 commits intoLaboratoria-learning:masterfrom
Open
Enviando proyecto valid-Credit-Card#56Jennifercarmen wants to merge 2 commits intoLaboratoria-learning:masterfrom
Jennifercarmen wants to merge 2 commits intoLaboratoria-learning:masterfrom
Conversation
cm6n
requested changes
Dec 26, 2017
cm6n
left a comment
There was a problem hiding this comment.
El código es muy claro pero hay un bug.
| do { | ||
| var cardNumber = prompt('Ingrese el numero de la tarjeta de credito a validar(13Digitos)'); | ||
| // Agregamos los numeros de la tarjeta a un array en orden inverso y convertimos a cada elemento en tipo numerico | ||
| } while ((cardNumber.length <= 12 || cardNumber.length >= 14));var reverseCardNumber = cardNumber.split('').reverse().map(Number); |
There was a problem hiding this comment.
Por favor ponga "var reverseCardNumber ..." en su propia linea.
| var cardNumber = prompt('Ingrese el numero de la tarjeta de credito a validar(13Digitos)'); | ||
| // Agregamos los numeros de la tarjeta a un array en orden inverso y convertimos a cada elemento en tipo numerico | ||
| } while ((cardNumber.length <= 12 || cardNumber.length >= 14));var reverseCardNumber = cardNumber.split('').reverse().map(Number); | ||
| var sumArrayElements = ''; |
There was a problem hiding this comment.
sumArrayElements debe tener un valor inicial de = 0 porque es tipo Number.
Es importante porque el sentido de "+=" depende del tipo del variable.
var x = '';
x += 1; // x es un string. entonces el 1 se convierte a un string tambien "1"
x += 2; // el 2 tambien se convierte a string. ahora x == "12" !
| // suma los dos digitos del elemento separado en dos cifras | ||
| reverseCardNumber[i] = (separatedDigits[0] + separatedDigits[1]); | ||
| } | ||
| // obtiene la suma total del array |
There was a problem hiding this comment.
Esto solo suma los digitos pares porque este for is solo para "i=i+2". Agrega otra for para sumar?
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hola :) les envio mi trabajo-
Jennifer Milagros Carmen Sosa
Muchas Gracias
Saludos desde Laboratoria-Perú