typescript check string length code example
Example 1: length in typescript
var uname = "Hello world"
console.log("Length :"+uname.length) // returns the total number of characters
// including whitespace
Example 2: count characters in typescript
function count (string) {
var count = {};
string.split('').forEach(function(s) {
count[s] ? count[s]++ : count[s] = 1;
});
return count;
}