Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

promise recursive settimeout

function recursiveSetTimeout(iterations) {
  return new Promise((resolve, reject) => {
    function repeat(count) {
     if (!count) return resolve("finished")
      console.log(count)
      setTimeout(repeat.bind(null, count-1), 300)
    }
    repeat(iterations)
  })
}
recursiveSetTimeout(3).then((result)=>{console.log(result)})
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to import your external js 
Javascript :: JS retrieve a String’s size 
Javascript :: react scroll reset in component 
Javascript :: check palindrome javascript 
Javascript :: get an html img tag from a string 
Javascript :: vue watch props 
Javascript :: Vue use props in style 
Javascript :: contenteditable javascript 
Javascript :: javascript format rupiah 
Javascript :: javascript assert 
Javascript :: how to convert milliseconds to time in javascript 
Javascript :: javascript convert number to string with 2 decimal places 
Javascript :: linear gradient reactjs 
Javascript :: yarn add react-native-elements 
Javascript :: import all images from folder reactjs 
Javascript :: altv rpc 
Javascript :: object to formdata 
Javascript :: rename file in js 
Javascript :: readonly vs disabled 
Javascript :: react router dom 
Javascript :: jsx foreach 
Javascript :: out of memory gc overhead limit exceeded. react native 
Javascript :: npm md5 
Javascript :: getcomputed style js 
Javascript :: electron open new window 
Javascript :: remove current table row in jquery 
Javascript :: moment now format 
Javascript :: javascript syntax for check null or undefined or empty 
Javascript :: how to get file extension in javascript 
Javascript :: angular disabled condition based 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =