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
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
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…
2 Likes