Use the parseInt Function in Basic Javascript

Not understanding what the problem is on here for this as I cannot get it to work: Seems close but no cigar. Anyone here want to explain this?

Your code so far


function convertToInteger(str) {
  parseInt(str)
}

convertToInteger("56");
convertToInteger("77");

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

You are correctly using parseInt, however you are not returning the value from the function. You need to use a return statement.

1 Like

Please elaborate a bit more.

return parseInt(str);