Skip to content

Brian Forcum Module_1#4

Closed
9shadesdesign wants to merge 1 commit intoJSCRIPT300-Spring2015:masterfrom
9shadesdesign:master
Closed

Brian Forcum Module_1#4
9shadesdesign wants to merge 1 commit intoJSCRIPT300-Spring2015:masterfrom
9shadesdesign:master

Conversation

@9shadesdesign
Copy link

Linted using jshint.com

Linted using jshint.com
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this does remove the "making" of a function from the loop, what you want to do here is declare the function outside the loop, or assign a function expression to a variable outside the loop, then pass in the function or variable name as the first argument to the setTimeout call. By invoking the function here, the function will be called as soon as the code executes rather than waiting until the timeout even has fired, which is the intention of the setTimeout call.

@jamdon
Copy link
Contributor

jamdon commented Apr 11, 2015

👍

@jamdon jamdon closed this Apr 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants