The JavaScript function parseInt can be used to force conversion of a given parameter to an integer, whether that parameter is a string, float number, number, etc.
I think other people have already given lots of valid answers here, but in my opinion the easiest approach would be to call .toString() on the original value, and to explicit the radix: