javascript relace space with hyphen code example Example: javascript replace spaces with dashes title = title.replace(/\s/g , "-");