Advertisement
Lulunga

Text Processing 02. Modern Times of #(HashTag)

Jul 19th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function hash(string) {
  2.     string = string.split(' ');
  3.     let words = string.filter(word => word.startsWith('#') && word.length > 1
  4.         && /^[a-zA-Z]+$/.test(word.slice(1)));
  5.     words = words.map(el => el.slice(1));
  6.     console.log(words.join('\n'));
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement