/**
* Formats a record using fixed-width fields.
*
* Name : left-aligned, width 15
* Age : right-aligned, width 10
* Salary : right-aligned, width 12, 2 decimal places
*/
function formatRecord(name, age, salary) {
return (
name.padEnd(15) +
String(age).padStart(10) +
salary.toFixed(2).padStart(12)
);
}
// Store the formatted string in a variable
const result = formatRecord("Alice", 31, 65000);
console.log(result);
/*
run:
Alice 31 65000.00
*/