onlycode.org

javascript
jquery
html
css
angularjs
node.js
ajax
html5
php
json
arrays
google-chrome
dom
regex
reactjs
ecmascript-6
javascript-events

your's history:
pass parameters in setin...

Pass parameters in setInterval function, just only code

setinterval | parameters | javascript-events | javascript

edit
setInterval( function() { funca(10,3); }, 500 );

37
tvanfosson, 19.01.2009 16:53




edit
setInterval(funca.bind(null,10,3),500);

36
Milind Anantwar, 01.10.2012 06:42




edit
setInterval(funca, 500, 10, 3);

35
Kev, 19.01.2009 16:54




edit
var f = this.someFunction;  //use 'this' if called from class
f.parameter1 = obj;
f.parameter2 = this;
f.parameter3 = whatever;
setInterval(f, 1000);

34
Juan, 14.12.2011 21:37



edit
setInterval(function() { funca(10,3); },500);

18
Simon, 19.01.2009 16:55




edit
     setInterval(function(a,b,c){

          console.log(a + b +c);  

      }, 500, [1],[2],[3]);

           //note the console will not print 6
          // rather it will print 123 in every 500 ms
          // because arguments are passed as array not as numbers
          //  tested in node.js ie 11 and chrome

17
manas, 10.01.2014 08:03




edit
setInterval(function,milliseconds,param1,param2,...)

26
Sudharsan S, 14.07.2015 17:40




edit
setInterval( ()=>{ funca(10,3); }, 500);

25
A.rodriguez, 02.07.2016 03:12




edit
OK --> reloadIntervalID = window.setInterval( "reloadSeries('"+param2Pass+"')" , 5000)

KO --> reloadIntervalID = window.setInterval( "reloadSeries( "+param2Pass+" )" , 5000)

24
animuson, 25.01.2012 19:23




edit
var fiveMinutes = 60 * 2;
var display = document.querySelector('#timer');
startTimer(fiveMinutes, display);
function startTimer(duration, display) {
    var timer = duration,
        minutes, seconds;

    setInterval(function () {
        minutes = parseInt(timer / 60, 10);
        seconds = parseInt(timer % 60, 10);

        minutes = minutes < 10 ? "0" + minutes : minutes;
        seconds = seconds < 10 ? "0" + seconds : seconds;

        display.textContent = minutes + ":" + seconds;
        --timer; // put boolean value for minus values.

    }, 1000);
}

11
Kaan Karaca, 02.07.2016 03:04

Add your just only code

your name:    



If you need full text click here

Some similar links Pass parameters in setInterval function ↓:
setInterval using a non anonymous function requiring parameters has to be inside an anonymous function. Why?

: how to pass parameters to callback function [duplicate]

How can I pass a reference to a function, with parameters? [duplicate]

How to pass “this” to window setInterval



This project is created for those who just need only code, wihout maaaaaaaaaaany words.