JS: Count Chars in String 🚀
/* xah_string_char_count(str) return number of chars in string str. http://xahlee.info/js/js_string_byte_sequence.html URL http://xahlee.info/js/js_string_real_length.html Version 2018-06-17 2022-10-18 */ const xah_string_char_count = ((str) => { let i = 0; for (let c of str) { i += 1; } return i; }); // -------------------------------------------------- // test console.log(xah_string_char_count("😂") === 1);
JavaScript, String
- JS: String Overview
- JS: Quote String
- JS: Template String
- JS: String Escape Sequence
- JS: Unicode Escape Sequence
- JS: String Operations
- JS: Iterate String
- JS: String Code Unit
- JS: Count Chars in String 🚀
- JS: Tagged Template String
- JS: Regex Functions
- JS: Convert String, Number
- JS: String Object
- JS: String Constructor
- JS: String.prototype