Question: I'm looking for a neat way of padding a positive or negative decimal number to create a fixed-length string, for example:

```
32.91    --> +032.9100
-2.1     --> -002.1000
 0.32546 --> +000.3255

```

It's easy enough to achieve (I've posted my attempt as an answer), but everything I've tried so far seems an awful lot more unwieldy than it ought to be. I'm sure there are some neat one-liners out there...

Answer: 
Here is Nina's solution compared with my own (slightly longer) solution:

```js
const fix1 = function (value, left, right) {
    return (value < 0 ? '-' : '+') + Math.abs(value).toFixed(right).padStart(left + right + 1, '0');
};
const fix2 = function (value, left, right) {
    var padded = Math.round(Math.abs(value) * Math.pow(10, right)).toString().padStart(left + right, '0');
    var withPoint = padded.substr(0, left) + '.' + padded.substr(left);
    var withSign = (value < 0 ? '-' : '+') + withPoint;
    return withSign;
};
console.log(fix1(6.55, 3, 1));  // +006.5
console.log(fix2(6.55, 3, 1));  // +006.6
```

I have a distrust of `toFixed()` because it fails in some situations, like the above.
You could check the sign of the number and apply a `toFixed` with the wanted right digits and add necessary left padding. Return with the sign in front of the string.

```js
function fix(v, left, right) {
    return (v < 0 ? '-' : '+') + Math.abs(v).toFixed(right).padStart(left + right + 1, '0');
}

console.log(fix(32.91, 3, 4));   // +032.9100
console.log(fix(-2.1, 3, 4));    // -002.1000
console.log(fix(0.32546, 3, 4)); // +000.3255
```