replace spaces with a dash of form js code example Example: javascript replace spaces with dashes title = title.replace(/\s/g , "-");