js算法之统计字符出现次数

2021-05-10 10:41:37 浏览数 (1)

代码语言:javascript复制
<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title></title>
</head>
<body>
	<script>
		var a=prompt("").split("");
		var b=prompt("");
		var j=0;
		for(var i=0;i<a.length;i  )
		{
			if(a[i]===b)
			{
				  j
			}
		}
		console.log(j);
	</script>
</body>
</html>

0 人点赞