function waitDuration(duration) {
  return new Promise(function(resolve, reject) {
    console.log('Waiting for ', duration.toString(), 'msec');
    setTimeout(
        function() {
          console.log('Done waiting');
          resolve();
        }, duration);
  });
}
// This function will be used only when we need to wait for data gathering.
This function will be used only when we need to wait for data gathering.
This function will be used only when we need to wait for data gathering .
function waitDuration(duration) {
  return new Promise(function(resolve, reject) {
    console.log('Waiting for ', duration.toString(), 'msec');
    setTimeout(
        function() {
          console.log('Done waiting');
          resolve();
        }, duration);
  });
}
function waitDuration ( duration ) { return new Promise ( function ( resolve , reject ) { console . log ( 'Waiting for ' , duration . toString ( ) , 'msec' ) ; setTimeout ( function ( ) { console . log ( 'Done waiting' ) ; resolve ( ) ; } , duration ) ; } ) ; }
This function will be used only when we need to wait for data gathering.
This function will be used only when we need to wait for data gathering .