Ask coding questions

← Back to all posts
1
Lambda School
chinedua (0)

https://repl.it/student/submissions/7049938
I am trapped on exercises 3 and 4 anyone got some help for me?

Commentshotnewtop
1
malvoliothegood (90)

Link does not work. I am guessing that you have deleted the repl.

1
chinedua (0)

@malvoliothegood sorry for the delay if you could still help here is the print screen

1
malvoliothegood (90)

@chinedua

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";