标签:title console cti var utf-8 lan text tle function
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script type="text/javascript">
var a = [‘a‘,‘a‘,‘a‘,‘b‘,‘b‘,‘c‘,‘c‘,‘c‘,‘c‘,‘d‘,‘hha‘,‘niha‘];
var s = ‘‘;
var json = {};
a.forEach(function(val,index){
if(s!=val){
s = val;
}
json[s]?json[s]++:(json[s]=1);
})
console.log(json)
</script>
</body>
</html>
标签:title console cti var utf-8 lan text tle function
原文地址:http://www.cnblogs.com/li-123/p/6903768.html