Answers for "initials string javascript"

0

initials string javascript

function songDecoder(song){
  	// trim() removes whitespaces from the beginning and/or end of a text.

  	// The split() method splits a String into an ordered list of substrings, 
    // puts those substrings into an array, and returns the array. The split is
    // done by looking for the word WUB
  
    // toString - converts into an string
  
    // replaceAll() - returns a new string with all occurrences of a pattern 
  	// replaced by areplacement.
  
    let song_remastered = song.trim().split("WUB").toString().replaceAll("," , " ")
    // console.log(song_remastered)
    let song_trimado = song_remastered.replace(/\s+/g,' ').trim()
    // console.log(song_trimado)
    return song_trimado
}

let song = "AWUBWUBBWUBWUBWUBC";
console.log(songDecoder(song));
Posted by: Guest on October-06-2021

Code answers related to "initials string javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language