remove leading and trailing spaces in javascript code example Example: javascript trim spaces value = value.trim();