File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212
1313// Means Function identifier should be a name not a number =============> explain this error message here.
1414// Whats the difference between function identifier and parameter?
15- // I believe function and identifier and parameter can be used interchangeably . So Parsing number 3 into the parameter would throw an error.
15+ // The parameter of a function must be name not number . So Parsing number 3 into the parameter would throw an error.
1616// Changing number 3 to 'num' as a placeholder fixes the error
1717
1818// Finally, correct the code to fix the problem
1919
2020// =============> write your new code here
2121
2222function square ( num ) {
23- return ( square = num * num ) ;
23+ return num * num ;
2424}
2525console . log ( square ( 3 ) ) ;
Original file line number Diff line number Diff line change @@ -19,8 +19,9 @@ function calculateBMI(weight, height) {
1919}
2020
2121function calculateBMI ( weight , height ) {
22- // return (weight / height).toFixed(1); - 1st attempt
23- return ( weight / ( height * height ) ) . toString ( ) . slice ( 0 , 4 ) ;
22+ //return (weight / height).toFixed(1); - 1st attempt
23+ //return (weight / (height * height)).toString().slice(0, 4); - 2nd attempt
24+ return "${(weight / (height * height)).toFixed(1)}" ;
2425}
2526
2627console . log ( `the bmi of 70 and 2.99 is ${ calculateBMI ( 70 , 2.99 ) } ` ) ;
Original file line number Diff line number Diff line change @@ -26,3 +26,4 @@ console.log(text);
2626
2727// Trim and regex pattern was the only saving grace I came across to resolve the underscore issue I had spent hours researching.
2828// I have however now modified and replaced the pattern for easy understanding with AI's help
29+ // CodeYourFuture AI Usage Guide reviewed again
You can’t perform that action at this time.
0 commit comments