Using the ParseInt function

Hi. I’m stuck on Use the ParseInt Function.

Here’s my code:

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

convertToInteger("56");

Thanks in advance for any help.

Your function is returning what was passed in: str. I think you meant to return a instead.

2 Likes

Simple as that. Thank you!