boolean questions get, set, in java.

so I was watching a video one the made a Boolean in c# that looked like-

public bool name { get; set; }

how is that different then a true false, and how do I write that in JavaScript?

There is no difference to a beginner programmer between

public bool name{get; set;}

and

public bool;

The difference between these two lies in one being a field while the other is a property. Properties are used to hide fields while allowing outside classes to edit them like fields and to customize getting and setting fields. For instance, you can write methods that are run when doing so and you can even make one private and the other public. Also fields are treated differently than properties under certain conditions. The most notable is that you can’t pass properties as ref or out parameters (which would defeat the purpose of hiding the field).

private bool _name { get; set; }
public bool name { 
    get{return _name;}
    set{_name=value;}
}

In javascript I believe you have to use methods instead of accessors (get/set) to get the same effect, i.e. something like this

private bool name;
public GetName(){
    return name;
}
public SetName(bool value){
    name=value;
}

Now it is easier to edit a property than change a field to a property. If a field is changed to a property then any code that accesses that field from the outside must be recompiled. However if a property is edited then that code might not need to be recompiled. Also since fields are treated differently than properties code might not even work if you change a field to a property.