function firstDiff(exp, act) {
  var i;
  for (i = 0; i < exp.length && i < act.length; ++i) {
    if (exp[i] != act[i]) {
      break;
    }
  }
  return i;
}
function firstDiff(exp, act) {
  var i;
  for (i = 0; i < exp.length && i < act.length; ++i) {
    if (exp[i] != act[i]) {
      break;
    }
  }
  return i;
}
function firstDiff ( exp , act ) { var i ; for ( i = 0 ; i < exp . length && i < act . length ; ++ i ) { if ( exp [ i ] != act [ i ] ) { break ; } } return i ; }
Given two arrays or strings, return the first element where they differ (shallow).
Given two arrays or strings return the first element where they differ ( shallow ) .