469,353 Members | 2,259 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,353 developers. It's quick & easy.

Javascript STATIC VARIABLE?

is there a way to declare static variable in a function like so?

function foo(){
static count;

count++;
}

Thank you.
Jul 23 '05 #1
1 15255
john_doe9 wrote:
is there a way to declare static variable in a function like so?

function foo(){
static count;

count++;
}

Thank you.


function foo()
{
foo.count = ++foo.count || 1;
alert(foo.count);
}

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Geoff | last post: by
6 posts views Thread by Alex Fitzpatrick | last post: by
5 posts views Thread by seans | last post: by
2 posts views Thread by ksr | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.