trim javascript strings for whitespac code example Example: javascript trim spaces value = value.trim();