var a = "I want apple"; var b = "an"; var position = 6; var output = [a.slice(0, position), b, a.slice(position)].join(''); console.log(output); var n = "123456780"; var dot = "."; var decimals = 4 * -1; var output = [n.slice(0, decimals), dot, n.slice(decimals)].join(''); console.log(Number(output));
http://mikemcl.github.io/bignumber.js/
const BigNumber = require('bignumber.js'); // 93774367102000000000 - 378000000000000 = 93773989102000010000 x = new BigNumber(93774367102000000000); y = new BigNumber(378000000000000); z = x.minus(y); z.toString(); n = 3.456 n = new BigNumber(x) n.toFixed(5) n.toFixed(10)