Function to convert string to number?

In appLab, is there are function or other easy to convert string to number?

Making a little calculator with a digit button for each of 0 to 9, so when one is pressed, the string digit is appended to the existing string.

For example, “1” + “2” = “12” but when the user pressed = want to convert to a number. Otherwise, I get “12” + “12” = “1212”, for example.

I guess I could keep track of the current power/place and calculate the current number that way but a conversion function would be easier, if it exists.

Try

parseInt(n1)

It’s not a code block, but it should work if you type it in code mode.

Mike

2 Likes