Answers for "int.parseint"

1

Use the parseInt Function

function convertToInteger(str) {
  return parseInt(str);
}

convertToInteger("56");
Posted by: Guest on February-09-2022
0

use + to parseint in js

const ratingValue = userInput.value;
if(+ratingValue > 1) {}   // + works exactly like a parseInt()

if(parseInt(ratingValue > 1)) {}
Posted by: Guest on November-16-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language