I am learning javascript, in the constructor there isn't a var declaration there, just get and set method there. Could anyone tell me why? I think there should be a statement like var name; in the constructor?
<script>
function Person(name){
    this.getName=function(){
        return name;
    };
    this.setName=function(value){
        name=value;
    };
}
</script>
why don't put
var name
in the constructor?
 
     
     
     
    