Im lost now after i returned the 56 value

Tell us what’s happening:

Your code so far


function convertToInteger(str) {
parseInt(str)
return 56
convertToInteger("56");}
function converToInteger(str) {
parseInt(str)
return 77
}

Your browser information:

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

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

Yay you’re almost done the first section.

sometimes I want to
home
return

but really I should
return home.

move your return to the same line :slight_smile:

oh no…not a riddle

  1. Return ends the function, you can’t return more than 1 thing at a time from a single function.
  2. Don’t hard code the values you’re returning. The function takes a parameter - “str”, parse that to an integer and return it.

so the return should have all three values

Which three values? This function takes only one argument and it should only return only that one argument, after parsing it to an integer.

For example:
ConvertToInteger(‘30’) - ‘30’ being the argument.

just one return, you don’t need to add a value that’s what the (str) is for.

the var str takes the value from the called function at the bottom of the screen…they have already written “56” in it…you change the value there to test your code.

when i change the value at the bottom to 77 it just removes the check from the return 56

function convertToInteger(str) {

return parseInt(str)

}

convertToInteger(“56”);

function convertToInteger(str) {

return parseInt(str)

}

convertToInteger(“56”);

GOT IT!!!Thanks

1 Like

There you go! :slight_smile:

oh sooo close, your code is correct now your just missing ; one little thing at the end of the middle line.

Yeah, but semicolons are so last-version javascript… :wink:

2 Likes