Lambda School
chinedua (0)
I am trapped on exercises 3 and 4 anyone got some help for me?

You are viewing a single comment. View All
malvoliothegood (366)


I hope this helps

No. 3

str is the name of the variable that is passed into the function called exerciseThree. It could be any string value, for example "apple". This is how it would be passed in exerciseThree("apple"). Inside of the function str would store the value "apple".

You need to create a new variable inside the your function to store the length of the value stored in str. You have written str.length, which will give you the length of the string stored in str (it will be 5 if str is storing "apple"). However, as you are not using a variable to store the length of str it will be disgarded. What do you think you have to do?

When you have assigned the length of str to your new variable, then you need to return the variable.

No. 4

You have just about got this one right! You have have rounded num1 but not assigned it to the variable rounded. In fact you have not declared rounded using let. How can you declare a variable and assign a value to it using one line of code? The example below shows how to declare a variable called fruit and assign to it the value "apple" using one line of code;
let fruit = "apple";