I need to adjust a string like so:
Cases where things should be adjusted:
Case a: " ", becomes ""
Case b: "z ", becomes "z"
Case c: " z", becomes "z"
Cases where things shouldn't be adjusted:
Case d: " z ", stays the same
Case e: "zzz zz zzz", stays the same
How can I achieve this in javascript?