Use the parseInt Function Help

Tell us what’s happening:

Your code so far


function convertToInteger(str) {
  
}

convertToInteger("56");

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 9765.81.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.120 Safari/537.36.

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

You need to put code inside the function called convertToInteger.

That function will receive an input that is a string, and you need to return a number.

function convertToInteger(str) {

var a = parseInt()

return 56

}

like this…

Not quiet. You gotta make it dynamic.

It would be something like

var a = parsetInt(str);

return a;
1 Like

or you could also directly return the value like

return parseInt(str);