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 JavaScript and the DOM (Retiring) Responding to User Interaction Delaying Execution with setTimeout()

Leslie Wolfe
Leslie Wolfe
8,700 Points

getting a "window.setTimeout is not a function" error in the console.

I'm copying the code exactly as it is from the video and I get an error: window.setTimout((something) => { console.log(something); }, 3000, 'Greetings, everyone!');

VM268:1 Uncaught TypeError: window.setTimout is not a function at <anonymous>:1:8

Any help to understand this would be great. Thanks!

3 Answers

Stephan Olsen
Stephan Olsen
6,650 Points

You misspelled the function name. It should be setTimeout and not setTimout.

window.setTimout((something) => {
  console.log(something); 
}, 3000, 'Greetings, everyone!');
Alejandro Narvaja
PLUS
Alejandro Narvaja
Courses Plus Student 7,340 Points

Hi, the error is in the word TimOut. The correct word is: TimeOut.

Leslie Wolfe
Leslie Wolfe
8,700 Points

ah. Sorry to waste your time with this stupid mistake! Thank you!

Alejandro Narvaja
Alejandro Narvaja
Courses Plus Student 7,340 Points

No problem. The error in words are fairly common and something that a developer have to review always.