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 a = ["CS348", "CS353", "CS381", "CS422", "CS448", "CS490-ES0", "CS490-DSO"];
var b = ["CS348", "CS352", "CS353", "CS354", "CS381", "CS422", "CS448", "CS456", "CS473", "CS490-DSO", "CS490-ES0"];
var output = [];
console.log('----before code-----');
console.log(a, b, output);
for (var i = 0; i < a.length; i++) {
  var indexInB = b.indexOf(a[i]);
  if (indexInB > -1){
    output.push(a[i]);
    a.splice(i, 1);
    b.splice(indexInB, 1);
    i--;
  }
}
console.log('----after code-----');
console.log(a, b, output);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
omarjmhpro
0viewers