This is my JS in nodeJS :
function test(a, room, seconds) {
console.log(a, room, seconds);
}
intervalid = setInterval(test, 1000, \'room\', 20);
console
You can use "this" in the following example:
const dgram = require('dgram');
const message = Buffer.from('from raspberry pi 3');
const client = dgram.createSocket('udp4');
var count = 0;
function intervalFunc() {
count++;
client.send(message, 3001, 'localhost', (err) => {
//client.close();
});
if (count == '5') {
clearInterval(this);
}
}
setInterval(intervalFunc, 1500);