字符统计

课程:Javascript · 编程练习

JavaScript编程练习 - 字符统计

练习内容

// 统计字符串中字符出现的频率\nfunction countCharacters(text) {\n const charCount = {};\n\n for (const char of text) {\n if (/[a-zA-Z0-9]/.test(char)) {\n const lowerChar = char.toLowerCase