xxxxxxxxxx
"this is foo bar".split("o").length - 1;
// returns 2
xxxxxxxxxx
const str = "Hello World";
const characterCount = str.length;
console.log(characterCount);
xxxxxxxxxx
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
xxxxxxxxxx
// this take a Object named person, that defines property names and then config it to false
Object.defineProperty(person, "name", { configurable: false });
xxxxxxxxxx
// This allows you to define or modify properties of an object with fine-grained control.
Object.defineProperty
xxxxxxxxxx
Start using this JavaScript Character Counter today and simplify your coding workflow!