the instructions say -
Ideate: Again, as noted with previous game plans, there are many solutions to this problem. We chose this one for readability.
- Add the .pad() method to the lodash object.
- Check to make sure the target length is longer than the current string length. If not, return the unpadded version of the string.
-Find the amount of padding to add to the start of the string by finding the difference between the target length and the string length, dividing by two, and rounding down the resulting number. We round down so that any uneven padding gets added to the end of the string, not the beginning, as specified in the instructions.
-Find the amount of padding to add to the end of the string by subtracting the string length and the starting padding length (calculated above) from the target length.
-Generate the padded string by adding the amount of starting padding and ending padding calculated above to each side of the current string.
- Return the padded version of the string.
Once you have tried implementing this game plan in code, move on to the next step to see how we do it.