User:Lunar werg/common.js

function count_words { var paragraphs = document.getElementsByTagName("p"); var combined = "";

for (var i = 0; i < paragraphs.length; i++) { var para = paragraphs[i].innerText; combined += para; }

console.log("Word Count: " + combined.split(/\s/).length); }

count_words;