AND gate function

 function and(x,y){
   if(x == 1 && y == 1) return 1;
   return 0;
 }