Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve() {
- let inputStr = document.getElementById('input').value;
- let output = document.getElementById('output');
- let input = inputStr.split('.').filter((p) => p.length > 0);
- for (let i = 0; i < input.length; i += 3) {
- let arr = [];
- for (let y = 0; y < 3; y++) {
- if (input[i + y]) {
- arr.push(input[i + y]);
- }
- }
- let paragraph = arr.join('. ') + '.';
- output.innerHTML += `<p>${paragraph}</p>`;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement