I am calling a method a which is returning a promise and inside it I am calling a method which do some operation and update the count variable. I want all the promise get finish once the count is done but it is not stopping after reaching the value 10.
  var count = 0;
  function a(p){
   return new Promise((resolve, reject) =>{
    console.log(count);
    if(count == 10) {console.log('sdfsdfsd'); resolve(Date.now()); }
    callee().then(() => { count++; a(); } )
  })
 }
 function callee(){ return new Promise((resolve) => resolve())}
 a(1).then((res) => console.log(res)).catch((res) => console.log(res));
 
     
    