I am in need of a JavaScript function which can take a value and pad it to a given length (I need spaces, but anything would do). I found this:
Code:
If you don't mind including a utility library, lodash library has _.pad, _.padLeft and _.padRight functions.