# Arguments in setInterval (javascript)

**URL:** <https://forum.kirupa.com/t/arguments-in-setinterval-javascript/23565>\
**Category:** programming\
**Created:** [June 19, 2003, 4:50pm UTC](https://forum.kirupa.com/t/arguments-in-setinterval-javascript/23565 "2003-06-19T16:50:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lostinbeta](https://avatars.discourse-cdn.com/v4/letter/l/db5fbb/32.png) [@lostinbeta](https://forum.kirupa.com/u/lostinbeta)\
**Post date:** [June 19, 2003, 4:50pm UTC](https://forum.kirupa.com/t/arguments-in-setinterval-javascript/23565/1 "2003-06-19T16:50:17Z")

</div>

Ok, I am really confused here. I haven’t worked much with setInterval in Javascript, but I assumed it worked the same as it does in Actionscript, but apparently it doesn’t.

This works in Flash…  
[AS]function notify(m) {  
trace(m);  
}  
setInterval(notify, 2000, “hello world”);[/AS]

This doesn’t work in Javascript…

```php
function notify(m) {
	alert(m);
}
setInterval(notify, 2000, "hello world");

```

I checked the O’Reilly Reference in my Dreamweaver and it says in there that you pass the arguments at the end like I did there, but it just isn’t working!

Anyone know what I am doing wrong?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 19, 2003, 4:56pm UTC](https://forum.kirupa.com/t/arguments-in-setinterval-javascript/23565/2 "2003-06-19T16:56:29Z")

</div>

not sure if this helps…

[http://www.insidedhtml.com/tips/functions/ts18/page4.asp](http://www.insidedhtml.com/tips/functions/ts18/page4.asp)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 19, 2003, 5:01pm UTC](https://forum.kirupa.com/t/arguments-in-setinterval-javascript/23565/3 "2003-06-19T17:01:49Z")

</div>

is there a setInterval? Ive always used setTimeout  
Im so behind in my javascript. 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 19, 2003, 5:04pm UTC](https://forum.kirupa.com/t/arguments-in-setinterval-javascript/23565/4 "2003-06-19T17:04:49Z")

</div>

Jubba: THAT LINK WAS PERFECT!!! Man I searched for 2 hours last night and didn’t find ANYTHING that helped me.

Apparently Netscape does it right and IE doesn’t… how ironic 😛

Anywho, this works in both Netscape and IE

```php
<SCRIPT LANGUAGE="JavaScript">
<!--
function notify(m, m2) {
    alert(m+" "+m2);
}
setInterval("notify('hello world', 'are you there?')" , 2000);
-->
</SCRIPT>

```

Sen: Yeah setInterval exists in Javascript 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 19, 2003, 5:14pm UTC](https://forum.kirupa.com/t/arguments-in-setinterval-javascript/23565/5 "2003-06-19T17:14:20Z")

</div>

4 minutes on google 🙂

😛

:trout:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 19, 2003, 5:17pm UTC](https://forum.kirupa.com/t/arguments-in-setinterval-javascript/23565/6 "2003-06-19T17:17:45Z")

</div>

yeah, it has to be in " "… i too was kinda confused by that… i noticed though that JS’s built-in functions/methods do not need the " " outside them … 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 19, 2003, 6:57pm UTC](https://forum.kirupa.com/t/arguments-in-setinterval-javascript/23565/7 "2003-06-19T18:57:03Z")

</div>

> \*Originally posted by Jubba \*  
> \*\*4 minutes on google 🙂

😛

:trout: \*\*

Google must hate me because that’s what I was using too :-\
