File tree Expand file tree Collapse file tree 4 files changed +30
-5
lines changed
Expand file tree Collapse file tree 4 files changed +30
-5
lines changed Original file line number Diff line number Diff line change 1- function countChar ( stringOfCharacters , findCharacter ) {
2- return 5
1+ function countChar ( str , char ) {
2+ let count = 0 ;
3+ for ( let i = 0 ; i < str . length ; i ++ ) {
4+ if ( str [ i ] === char ) {
5+ count ++ ;
6+ }
7+ }
8+ return count ;
39}
410
511module . exports = countChar ;
Original file line number Diff line number Diff line change 11function getOrdinalNumber ( num ) {
2- return "1st" ;
2+ nonStr = num . toString ( ) ;
3+ if ( nonStr . endsWith ( "1" ) && nonStr !== "11" ) {
4+ return nonStr . concat ( "st" ) ;
5+ } else if ( nonStr . endsWith ( "2" ) ) {
6+ return nonStr . concat ( "nd" ) ;
7+ } else if ( nonStr . endsWith ( "3" ) ) {
8+ return nonStr . concat ( "rd" ) ;
9+ } else {
10+ return "Invalid" ;
11+ }
12+
313}
414
515module . exports = getOrdinalNumber ;
16+
17+
Original file line number Diff line number Diff line change 1- function repeatStr ( ) {
2- return "hellohellohello" ;
1+ function repeatStr ( str , count ) {
2+ return str . repeat ( count ) ;
33}
44
55module . exports = repeatStr ;
Original file line number Diff line number Diff line change 1+ * [32m1-implement-and-rewrite-tests[m
2+ 3-dead-code[m
3+ Sprint-3/2-practice-tdd[m
4+ acoursework/sprint-2[m
5+ acoursework/sprint-2_old[m
6+ coursework/sprint-3-implement-and-rewrite[m
7+ main[m
You can’t perform that action at this time.
0 commit comments