javascript
Published on January 26, 2024By DeveloperBreeze
// Input sentence
const sentence = 'This is a sample sentence.';
// Calculate word count by splitting the sentence at spaces
const wordCount = sentence.split(' ').length;
// Display the word count
console.log('Word Count:', wordCount);
Comments
Please log in to leave a comment.