js format string with variables code example Example: js string template decimals var num = 5.1234; var n = num.toFixed(2);