判断字符串中字符出现次数

Posted 小白字太白

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了判断字符串中字符出现次数相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>txt</title>
	<style>
		p.i{
			letter-spacing: 2px;
			
		}
	</style>
</head>
<body>
	<p></p>
	<script>
	function debug(msg){
		var log = document.getElementById("debuglog");

		if(!log){
			log = document.createElement("div");
			log.id = "debuglog";
			log.innerHTML = "<h1>Debug Log";
			document.body.appendChild(log);
		}
		var pre = document.createElement("pre");
		var text = document.createTextNode(msg);
		pre.appendChild(text);
		log.appendChild(pre);
	}
	
	debug(‘s‘);
	</script>
	
</body>
</html>

  

以上是关于判断字符串中字符出现次数的主要内容,如果未能解决你的问题,请参考以下文章