I have created the following jsfiddle which highlights my problem.
http://jsfiddle.net/UTG7U/
var ExampleObject = function() {
var myArray = new Array();
this.example = function() {
alert(this.myArray);
};
}
var exampleObj = new ExampleObject();
exampleObj.example();
I am new to JavaScript and trying to create an object, field and a method.
I can’t get my method to access my field variable.
you were trying to access a local variable using this operator which is wrong, so here is the working example
Link: http://jsfiddle.net/3QN37/