From ee7a5a71150554136f5d4ab60d42fd8fca958e8b Mon Sep 17 00:00:00 2001 From: Rishabh Tayal <135199635+tayalrishabh96@users.noreply.github.com> Date: Tue, 31 Dec 2024 15:37:18 +0530 Subject: [PATCH 1/2] Update app.js setInterval function is being invoked every millisecond -> changing it to 2000ms --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index f89bfa8f..0ce6dba5 100644 --- a/app.js +++ b/app.js @@ -34,7 +34,7 @@ setInterval(function(str1, str2) { //console.log(logs[i]) i++ if (i == logs.length) i = 0 -}, 1, "Hello.", "How are you?"); +}, 2000, "Hello.", "How are you?"); function makeid(length) { var text = ""; From 49c2d2eaeb38aad0b71a874d9f29c94ca57f1f1b Mon Sep 17 00:00:00 2001 From: Rishabh Tayal <135199635+tayalrishabh96@users.noreply.github.com> Date: Tue, 31 Dec 2024 15:40:51 +0530 Subject: [PATCH 2/2] Update app.js adds comments explaining function and its arguments --- app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app.js b/app.js index 0ce6dba5..18526a1b 100644 --- a/app.js +++ b/app.js @@ -21,6 +21,11 @@ app.get('/health', (req, res) => res.send({"status": "OK", "time": new Date()})) var port = process.env.PORT || 8080; app.listen(port); +// setInterval(callback, delay, [arg1, arg2, ...]) +// callback: The function to execute at each interval. +// delay: Time in milliseconds between each execution of the callback. +// arg1, arg2, ... (optional): Additional arguments passed to the callback function. + setInterval(function(str1, str2) { var text = makeid(40); var ran = Math.random()