Please look at the code snippet below ,Which also having comments(my understandings) wrapped up with the code.Please let me know weather my understanding about the below function are correct or not?
function MyViewModel() {
this.DisplayInside = function () { //Is this someting like a public method can be called out side MyViewModel
console.log("DisplayInside");
}
var DisplayInside = function () { ///Is this someting like a private method can be called within MyViewModel
console.log("DisplayInside");
}
}
MyViewModel.DisplayOutSide = function () { //Is this someting like a public static method
console.log("DisplayOutSide");
}
$(document).ready(function () {
MyViewModel.DisplayOutSide(); //Call the static method
var model = new MyViewModel();
model.DisplayInside(); //Call the function using object
});
Is there any better approach to implement oops concepts in java Script.