File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22// =============> write your prediction here
33/*
44I predict the function will throw a SyntaxError as the variable str has already been declared in the function parameter
5- function capitalize will capitalise the first letter with index 0
5+ function capitalise will capitalise the first letter with index 0
66and will append the sliced string from index 1 which is the second letter
77*/
88
@@ -25,8 +25,8 @@ As we can see the str variable has already been declared in the prameter of the
2525As we can see the str variable has already been declared in the prameter of the function instead we just return the value */
2626
2727function capitalise ( str ) {
28- return str [ 0 ] . toUpperCase ( ) + str . slice ( 1 ) ;
28+ return str [ 0 ] . toUpperCase ( ) + str . slice ( 1 ) ;
2929
3030}
31- capitalise ( "ebrahim" ) ;
32- capitalise ( 'salomi' ) ;
31+ console . log ( capitalise ( "ebrahim" ) ) ;
32+ console . log ( capitalise ( 'salomi' ) ) ;
Original file line number Diff line number Diff line change @@ -43,4 +43,4 @@ function getLastDigit(num) {
4343/* the reason why getLastDigit isn't working properly is that it doesn't accept any arrguments where there isn't any perameters in its difination.
4444where it uses the golabal varaible 'num' decalred outside the funtion and already set to 103
4545
46- The correct code includes a parameter 'number ' in the difination this allows the function to accept the number passed to it when called*/
46+ The correct code includes a parameter 'num ' in the difination this allows the function to accept the number passed to it when called*/
Original file line number Diff line number Diff line change 1515// It should return their Body Mass Index to 1 decimal place
1616
1717function calculateBMI ( weight , height ) {
18- let result = Number ( weight / ( height * height ) ) ;
19- return result . toFixed ( 1 ) ;
18+ let result = ( weight / ( height * height ) ) ;
19+ return Number ( result . toFixed ( 1 ) ) ;
2020
2121
2222}
You can’t perform that action at this time.
0 commit comments