Advertisement
Liliana797979

pro

Sep 24th, 2021
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. function solve() {
  2. let input = document.getElementById('input').value
  3.  
  4. let splittedText = input.split('.').filter(x => x !== "").map(y => y + ".")
  5. let output = document.getElementById('output')
  6. output.innerHTML = ""
  7.  
  8. let paragraphNum = Math.ceil(splittedText.length / 3)
  9.  
  10. for (let i = 0; i < paragraphNum; i++) {
  11. let finalString = sentence.splice(0, 3).join(", ")
  12. output.innerHTML += `<p>${finalString}</p>`
  13. }
  14.  
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement