tofixed similar code example Example: tofixed //round number to 2 digits var num = 5.56789; var n = num.toFixed(2);