Declaring variables with this or var?

Posted by meo on Stack Overflow See other posts from Stack Overflow or by meo
Published on 2010-04-25T20:35:44Z Indexed on 2010/04/25 20:43 UTC
Read the original article Hit count: 198

Filed under:

What is the difference between declaring a variable with this or var ?

var foo = 'bar'

or

this.foo = 'bar'

When do you use this and when var?

© Stack Overflow or respective owner

Related posts about JavaScript