How to make the console method setInterval wrote the text not in a second, and after 5?

That is, to write:
"You look in the console for 5 seconds"
"You look in the console already 10 seconds"
"You look in the console for 15 seconds"
"You look in the console for 20 seconds"

var counter = 5;

var printMessage = function () {
console.log("You look in the console has" + counter + "seconds");
counter++;
};

var internvalId = setInterval(printMessage, 5000);
July 2nd 19 at 17:39
1 answer
July 2nd 19 at 17:41
Solution
instead of counter++; do counter += 5;

either
var counter = 1;
var periodSec = 5,
 periodMsec = periodSec * 1000;

var printMessage = function () {
console.log("You look in the console is" + (counter * periodSec) + "seconds");
counter++;
};

var internvalId = setInterval(printMessage, periodMsec);
Thank you! - jarret.Cruickshank30 commented on July 2nd 19 at 17:44
Why are you so, you simply force these people to treat Q&A forum as the community free of freelancers. And they are in the end: "how to add a string to the line", "how to access the array element", "how to multiply 2 by 2", right? - gustave_Kertzmann52 commented on July 2nd 19 at 17:47
Any self-respecting accountant will tell you that 2 times 2 just, 2 on 2 is 8 - 2 itself, 2 Director, 4 on paper - geovanni_Hegmann commented on July 2nd 19 at 17:50

Find more questions by tags JavaScript