Javascript maths

Would javascript be a good tool to do some simple maths on a page?

I want a visitor to enter a number eg 28, then use java to display what the number is -11.

Very simple, I could do it with php but would like to keep it all on one page without the need of a submit button.

eg visitor enters 28, and is given the answer 17.

Asked too soon, found just what I’m looking for here