Yngvarr

Generation

generate functionTue, 24 Jan 2023

5 знаков после запятой

function getFloat(number, precision) { if(precision === undefined) { precision = 2; } return number.toFixed(precision); } getFloat(1.123456); // 1.12 getFloat(1.123456, 3); // 1.123

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant