What's missing in this code?
getHashTags('Breaking News: Major Earthquake in California');
// Output: ['#earthquake', #california', '#breaking']
getHashTags('Big Red Fox Jumps Really High');
// Output: ['#really', '#jumps', '#high']
getHashTags('Wow! Amazing: World-record performance.');
// Output: ['#worldrecord', '#performance', '#amazing', ]
function getHashTags(headline) {
// Split the headline into words and remove punctuation
const words = headline
.toLowerCase()
.replace(/
/g, '') // Remove non-word characters
.split(' ');
const sortedWords = words.sort(
(a, b) => b.length - a.length || words.indexOf(a) - words.indexOf(b)
);
const hashtags = sortedWords.
(0, 3).map((word) =>
);
return hashtags;
}
Type or select from these options