(Use the parseInt Function)

Tell us what’s happening:
I don’t have understand what i should do

Your code so far


function convertToInteger(str) {
  
}

convertToInteger("56");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function/

Okay That I understand it the first is right now for others I don’t understand what to do

convertToInteger(“56”) should return a number
convertToInteger(“56”) should return 56
convertToInteger(“77”) should return 77
convertToInteger(“JamesBond”) should return NaN

At that I don’t understand the code that I should do?
I try convertTolnteger(“56”)
and of all them same with the code above but it isn’t right

I understand of all this but i don’t understand the last one.

I don’t understand the last sentence

I read it but again I don’t understand it sorry for tiredness but I don’t understand it

I believe it is easy but now I have many hours which I try to do it and mmy brain has got tired

I don’t understand it all I haven’t got a part of lesson!

Well I believe she understood the whole var.

The problem in this section is that instead of var you should pay attention to this part here.

Use parseInt() in the convertToInteger function so it converts the input string str into an integer, and

returns it.

This changes the approach a bit. You shouldn’t be focusing on creating a var for the parseInt inside the function. But to return the parseInt inside the function. I got a bit confused there too and I understand what you meant.

Good Luck and Keep coding.

5 Likes

Thank you for your answer.

2 Likes

Thank you!!! I was confused about the wording too! Based on your explanation, I was able to get it. :raising_hand_woman:t5:‍♀

3 Likes