how to calculate length of string i javascript code example
Example 1: js string length
let str = "foo";
console.log(str.length);
// 3
Example 2: javascript create string of given length
var str = new Array(len + 1).join( character );
let str = "foo";
console.log(str.length);
// 3
var str = new Array(len + 1).join( character );