File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
Sprint-3/revise/implement Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ function cardValidator(num) {
1010 // console.log(`compare ${numStr[i]} con ${firstDigit} in position ${i}`);
1111
1212 if ( numStr [ i ] !== firstDigit ) {
13- // console.log(`diferent digit found: ${numStr[i]}`);
13+ // console.log(`different digit found: ${numStr[i]}`);
1414 return true ; // Found at least two different digits
1515 }
1616 }
@@ -20,7 +20,7 @@ function cardValidator(num) {
2020}
2121
2222console . log ( cardValidator ( 1111111111111111 ) ) ; // Output: false and stop in the first return.
23- // console.log(cardValidator(1234567890123456)); // Output: true
24- // console.log(cardValidator(2222222222222222)); // Output: false
25- // console.log(cardValidator(3333333333333334)); // Output: true
23+ console . log ( cardValidator ( 1234567890123456 ) ) ; // Output: true
24+ console . log ( cardValidator ( 2222222222222222 ) ) ; // Output: false
25+ console . log ( cardValidator ( 3333333333333334 ) ) ; // Output: true
2626
Original file line number Diff line number Diff line change 1515// And a character char that does not exist within the case-sensitive str,
1616// When the function is called with these inputs,
1717// Then it should return 0, indicating that no occurrences of the char were found in the case-sensitive str.
18+
19+
20+ function countChar ( str , char ) {
21+
22+ let findSameLetter = 0 ;
23+ for ( let i = 0 ; i < str . length ; i ++ ) {
24+ if ( str [ i ] === char ) {
25+ findSameLetter ++ ;
26+ }
27+ }
28+ return findSameLetter ;
29+ }
30+ // 8
31+ console . log ( countChar ( "Anibal" , "a" ) ) ;
You can’t perform that action at this time.
0 commit comments