-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsecond.js
More file actions
24 lines (19 loc) · 1.05 KB
/
second.js
File metadata and controls
24 lines (19 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const paragraph = document.getElementById('paragraph');
const sentences = paragraph.textContent.split('. ');
paragraph.innerHTML = sentences.join('.<br>');
const words = paragraph.textContent.split(' ');
words.forEach(word => {
if (word.length > 8) {
paragraph.innerHTML = paragraph.innerHTML.replace(word, `<span class="highlight">${word}</span>`);
}
});
const sourceLink = document.createElement('a');
sourceLink.href = "https://www.inc.com/jeff-haden/this-new-linkedin-study-reveals-top-8-jobinterview-questions-and-how-great-job-candidates-answer-them.html";
sourceLink.textContent = "Source";
paragraph.insertAdjacentElement('afterend', sourceLink);
const wordCount = paragraph.textContent.split(/\s+/).length;
const wordCountElement = document.createElement('p');
wordCountElement.textContent = `Word Count: ${wordCount}`;
paragraph.insertAdjacentElement('afterbegin', wordCountElement);
paragraph.innerHTML = paragraph.innerHTML.replace(/\?/g, '🤔');
paragraph.innerHTML = paragraph.innerHTML.replace(/!/g, '😲');