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

using the window.setTimeout Method - JS

If I want to make an alert box to show my the words 'Hello' and then 'Yes, I see you, Hello back!' using this code? How would I?

window.setTimeout(() => {alert('Hello');}, 3000, 'Yes, I see you, Hello back!');

In other words, I want to click that button once and then have the alert say "yes!" And then have it say "Yes, I see you, Hello back".

1 Answer

Steven Parker
Steven Parker
242,284 Points

If I understand correctly what you want, you just need two "alert" calls in your function:

window.setTimeout(() => {alert('Hello'); alert('Yes, I see you, Hello back!');}, 3000);

Man, that was simple. I should of just spent more time thinking about it....thanks.