Use the parseInt Function1

Use the parseInt Function1
0.0 0

#1

Tell us what’s happening:
What’s wrong in the below code?

Your code so far


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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36.

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


#2

actually your function is converting str to integer but is not returning anything.
it must return that integer :slight_smile: just about to be done.


#3

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.