'To find how many characters are remaining from a total of 140, slice function
To do that I have written code below
var tweet = prompt("compose your tweet");
var tweetcount = tweet.length;
alert("you have written " + tweetcount + " characters you have " + (140 - tweetcount) + " characters remaining. ");
var tweet = "cut down your tweet";
tweetcount.slice(141, 1);
While it effectively gives a prompt to write and after that tells how many characters left + over limit of characters.
But in the console why does it say tweetcount.slice is not a function?
Solution 1:[1]
var tweet = prompt ("compose your tweet"); var tweetunder140 = tweet.slice(0,140); alert(tweetunder140);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | amin khan |
