JavaScript doesn’t natively support the string trim (removing leading and trailing spaces) function, but this function is quite useful and required from time to time. Fortunately, you can do this as easily as by just single line of code using regular expression and can add support to all the string objects using the JavaScript prototyping. […]