Use the parseInt Function .1

Tell us what’s happening:
convertToInteger("56") should return 56

convertToInteger("77") should return 77

Your code so far

function convertToInteger(str) {
  var r =parseInt()
  return r;


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.102 Safari/537.36 OPR/57.0.3098.106.

parseInt() doesn’t work if you don’t put an argument in it
You are not using str anywhere, how could the function give a result depending on what is passed inside the function without using the parameter?

1 Like

thanks for the reminder, small mistakes

I personally prefer Number() over parseInt().