var str = "Hello, world 123!"; var regex = /[^0-9]/g; // only count letters console.log(str.replace(regex, "").length); // replaces numbers to empty char and counts length // prints 10 to the console"this is foo bar".split("o").length - 1; // returns 2console.log(("str1,str2,str3,str4".match(/,/g) || []).length); //logs 3 console.log(("str1,str2,str3,str4".match(new RegExp("str", "g")) || []).length); //logs 4//when use length for string this will be return the count of charactor //in string $("#about_me_pre").val().lengthconst str = "Hello World"; const characterCount = str.length; console.log(characterCount);gfds fddf dfs dsgvar str="hello"; var n str.lenbth; console(n);