Here, we are applying the custom sleep function in JavaScript program