Im lost now after i returned the 56 value

Im lost now after i returned the 56 value
0

#1

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


#2

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:


#3

oh no…not a riddle


#4
  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.

#5

so the return should have all three values


#6

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.


#7

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.


#8

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


#9

function convertToInteger(str) {

return parseInt(str)

}

convertToInteger(“56”);


#10

function convertToInteger(str) {

return parseInt(str)

}

convertToInteger(“56”);

GOT IT!!!Thanks


#11

There you go! :slight_smile:


#12

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


#13

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