Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Write a JavaScript function replaceSpaces(str) that replaces the white-space characters in a text with .
- Write JS program spaceReplacer.js that invokes your function with the sample input data below and prints
- the output at the console. */
- "use strict";
- function replaceSpaces(str) {
- str = str.replace(/\s/g, '');
- return str;
- }
- console.log(replaceSpaces("But you were living in another world tryin' to get your message through"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement