Use of the parseInt Function

What is missing?

Your code so far


function convertToInteger(str) {
   var a = parseInt("str");
   return a;  
}

convertToInteger("56");

Your browser information:

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

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

You are trying to parse the literal string "str" instead of the parameter passed into the function.

1 Like

You don’t need to put str in quotes.

1 Like