Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var old = ('Iseeit Inc');
var str2 = ('iseeiT');
var str3 =('isEEit Inc');
var str4 =('isEEitNEW Inc');
var str5 =('isEEit Aus');
console.log(determineConflict(old,str2));
console.log(determineConflict(old,str3));
console.log(determineConflict(old,str4));
console.log(determineConflict(old,str5));
function determineConflict(o,n){
        if(checkExactMatch(o,n)){
            return {conflict: true, partialMatch: false};
        }
        if(checkPartialMatch(o,n)){
            return {conflict: true, partialMatch: true};
        }
        return {conflict: false};
    }
   function checkPartialMatch(o,n){
     var result = false ;
      o = o.split(' ');
      n = n.split(' ');
     if(o[0].toLowerCase() == n[0].toLowerCase()){
       result = true;
     }
  return result;
   }
   function checkExactMatch(o,n){
      var result = false;
      if(o.toLowerCase() == n.toLowerCase()){
          result = true;
     }
  return result;
  
   }
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers