Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Print three times in the console "Hello!"(with a for loop) and put a delay of 3 seconds between each word printed.

I don' know how I should do that.

2 Answers

Hey ! You can use this :

setInterval(function(){ console.log("Hello"); }, 3000);

Where did you learn this method?

At the Jquery course

// This should deliver the answers you want

for(var i = 0; i < 3; i++){ setTimeout(() => console.log("Hello"), 3000); }

I tried that and it didn't work.You can try it in your browser. Thank you!