File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
1-implement-and-rewrite-tests/implement Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 88// write one test at a time, and make it pass, build your solution up methodically
99// just make one change at a time -- don't rush -- programmers are deep and careful thinkers
1010function getCardValue ( card ) {
11- let rank = card . slice ( 0 , - 1 ) ;
11+ let rank = card . slice ( 0 , card . length - 1 ) ;
1212 if ( rank === "A" ) {
1313 return 11 ;
1414 }
@@ -23,6 +23,10 @@ function getCardValue(card) {
2323 return "Invalid card rank" ;
2424}
2525
26+ let car = "10♠" ;
27+
28+ let ran = car . slice ( 0 , - 1 ) ;
29+ console . log ( ran ) ;
2630// The line below allows us to load the getCardValue function into tests in other files.
2731// This will be useful in the "rewrite tests with jest" step.
2832module . exports = getCardValue ;
Original file line number Diff line number Diff line change 11function find ( str , char ) {
22 let index = 0 ;
3+
34 while ( index < str . length ) {
45 if ( str [ index ] === char ) {
56 return index ;
67 }
78 index ++ ;
89 }
9-
1010 return - 1 ;
1111}
12-
1312// console.log(find("code your future", "u"));
1413// console.log(find("code your future", "z"));
1514
You can’t perform that action at this time.
0 commit comments