Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var arrNumber = [1, 0, 9, 4, 8, 5, 7, 3, 2, 8, 6, 2, 4, 6, 8, 3, 5, 7, 5];
var arrString = ["a", "u", "e", "o", "i", "a", "i", "u", "i"];
var arrDuplicateValues = [];
// Count duplicated values
arrDuplicateValues = new Array();
arrNumber.forEach(function(x) {
  arrDuplicateValues[x] = (arrDuplicateValues[x] || 0) + 1;
});
console.log(arrDuplicateValues);
arrDuplicateValues = new Array();
arrString.forEach(function(x) {
  arrDuplicateValues[x] = (arrDuplicateValues[x] || 0) + 1;
});
console.log(arrDuplicateValues);
console.log(arrDuplicateValues["i"]);
Output 300px

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers