File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Sprint-2/3-mandatory-implement Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 55
66// You should call this function a number of times to check it works for different inputs
77
8+ // I thought adding "lbs" need to be inside a string .
9+ // i converted the string back to number
10+
811function toPounds ( kg ) {
912 const pounds = kg * 2.20462 ;
10- return ` ${ pounds . toFixed ( 2 ) } lbs` ; // returns a string
13+ return Number ( pounds . toFixed ( 2 ) ) ;
1114}
15+ console . log ( `${ toPounds ( 5 ) } lbs` ) ;
16+
1217
13- // Test cases
14- console . log ( toPounds ( 1 ) ) ; //the output " 2.20 lbs"
15- console . log ( toPounds ( 5 ) ) ; //the output is " 11.02 lbs"
16- console . log ( toPounds ( 10 ) ) ; //the output is " 22.05 lbs"
18+ // more Test cases
19+ console . log ( ` ${ toPounds ( 1 ) } lbs` ) ; // 2.20 lbs
20+ console . log ( ` ${ toPounds ( 5 ) } lbs` ) ; // 11.02 lbs
21+ console . log ( ` ${ toPounds ( 10 ) } lbs` ) ; // 22.05 lbs
You can’t perform that action at this time.
0 commit comments