Add + at the beginning of a variable to convert it into a Number. For example:
const numberInsideAString = "1231.12";
console.log(+numberInsideAString);
For a detailed explanation of how + converts various JavaScript types, see Cast to Number in Javascript using the Unary (+) Operator