Skip to content

Commit

Permalink
Merge pull request adambard#1659 from xssc/patch-2
Browse files Browse the repository at this point in the history
[javascript/en] Added setInterval
  • Loading branch information
vendethiel committed Oct 19, 2015
2 parents f4c1f3d + 7fdce92 commit b354013
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions javascript.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,9 @@ myFunction("foo"); // = "FOO"
// Note that the value to be returned must start on the same line as the
// `return` keyword, otherwise you'll always return `undefined` due to
// automatic semicolon insertion. Watch out for this when using Allman style.
function myFunction()
{
function myFunction(){
return // <- semicolon automatically inserted here
{
thisIsAn: 'object literal'
}
{thisIsAn: 'object literal'}
}
myFunction(); // = undefined

Expand All @@ -310,6 +307,12 @@ setTimeout(myFunction, 5000);
// Note: setTimeout isn't part of the JS language, but is provided by browsers
// and Node.js.

// Another function provided by browsers is setInterval
function myFunction(){
// this code will be called every 5 seconds
}
setInterval(myFunction, 5000);

// Function objects don't even have to be declared with a name - you can write
// an anonymous function definition directly into the arguments of another.
setTimeout(function(){
Expand Down

0 comments on commit b354013

Please sign in to comment.