Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.