JavaScript
Length
You can take word count of particular word by the length keyword.
Example of tweet word count.
Run this in your code snippet.
- Take maximum word limit as 140 characters.
var tweetCount = prompt ("Enter your word count here ");
alert("Your word count is " + tweetCount + "Youre remaining " + ( 140 - tweetCount ) + " characters ");
Slice
From Slice Keyword you can slice the word limit to the limit that you want.
var tweetCount = prompt ("Enter your word count here ");
var tweetBelow140 = tweetCount.slice(0,140);
alert(tweetBelow140);
Comments
Post a Comment