- Home /
Question by
NathanDaniels · Apr 21, 2011 at 11:17 PM ·
javascriptstaticpublicjava-is-not-javascript
is there a diffrence btween public var and static var javascript
is there a diffrence btween public var and static var in javascript
Comment
Answer by DaveA · Apr 21, 2011 at 11:45 PM
Yes, non-static are per-instance of the script, and static are just one for the whole project, so to speak. I'm sure someone else might word it better, but if you don't know about 'static', google it.
public means that other scripts can access it.
You can have public static vars too. Non-public static vars would not be seen by other scripts, where public ones would.
public
doesn't exactly mean per-instance. It exposes the variable to classes other than this one so that they can access it hence it is called an "access modifier" :) .