To add on, the toFixed() method will actually return a string value. So, if you need an integer instead, you'll have to apply one more filter. You can simply wrap the result from nnnnnn's function with Number() to convert it into an integer:
function insertDecimal(num) {
return Number((num / 100).toFixed(2));
}
insertDecimal(99552) //995.52
insertDecimal("501") //5.01
The downside here is that JavaScript will eliminate trailing '0's. For example, 439980 will become 4399.8 instead of 4399.80 as expected:
insertDecimal(500); //5
If you're just displaying the results, then nnnnnn's initial version works perfectly!
observations
The Number function in JavaScript may produce unexpected outcomes for certain inputs. To bypass using Number, you can coerce the string value to an integer by utilizing unary operators: unary operators
return +(num / 100).toFixed(2);
or simply multiply by 1 like this:
return (num / 100).toFixed(2) * 1;
Fun fact: JavaScript's fundamental math system can be quite peculiar