Change a variable into a number format

I am new.

When I try to add a variable and a number from a textbox they add as strings:

var m=(;
var b=m+24

if m=12 then I get b=1224

Now when I add number to it I get an error in the page:

var m=number(;
var b=m+24

I am sure all the other code is correct.

How do you change a variable into a number format?

The simplest way is:

var m=+(;
var b=m+24

What happens if I want to use a decimal # that should not be truncated?

parseInt will truncate it, use parseFloat instead :slight_smile:

another option is to use the javascript Number Class

Use parseInt

var m=parseInt(, 10);
var b=m+24