higher order function : doWithLoading

by Cristi Salcescu

JavaScript

function doWithLoading(fn){
	console.log("start loading");
  let returnValue = fn();
  console.log("end loading");
	return returnValue;
}

function process() {
	console.log("do process");
}

doWithLoading(process);
//start loading
//do process
//end loading