I am trying to make a promise function repeatedly call itself after interval
The promise function:
function bd() {
return new Promise((resolve, reject) => {
// gets message_bd
resolve(message_bd)
})
}
I try to call it repeatedly every 3 seconds like so:
var interval = setInterval(function(){
bd().then((message_bd) => {
console.log(message_bd)
},3000);
the bd() gets called after the first 3 seconds and the message_bd gets resolved (everything's working), but then I get this error as the second 3 seconds finish:
bd().then((message_bd) => {
^
TypeError: bd is not a function
Would appreciate any help :)