function countWords() {
var text = document.getElementById('inputText').value;
var words = text.split(/\s+/).filter(function (word) {
return word.length > 0;
});
var wordCount = words.length;
document.getElementById('wordCount').innerText = 'Word count: ' + wordCount;
}