Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Squeeze

Write a javascript function squeeze that takes a string as an argument and returns a the same string with consecutive duplicate letters removed.

Examples:

  • banana => banana
  • shmeeeeeee! => shme!
  • yabba dabba doo => yaba daba do
  • AW-WEE-OO KILLER TOFU => AW-WE-O KILER TOFU

Bonus

  • If you used iteration over the string, try doing it without a loop (hint: look at regular expressions).
    • If you used regular expressions, try doing it without them.
  • Have the function return an array containing the squeezed word, and then the remaining elements are the letters removed.

About

[javascript, quick]

Resources

Stars

0 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages