Private function not returning value
javascript
Solution
You forgot the `return` statement. Try the following:
this.getPrivate = function () {
return _private();
};
If no value is explicitly returned from a Javascript function, the function is considered to return `undefined`; no warning will be emitted.
Problem
I have code as below. ``` var Main = function () { var a, b, c, d; a = 1; b = true; c = undefined; var _private = function () { return 'Function with Private acceess'; }; this.getPublic = function () { return 'Function with Public access'; }; this.getPrivate = function () { _private(); }; }; var o = new Main(); console.log(o.getPublic()); console.log(o.getPrivate()); ``` In the code above I am trying to access the private method of the `Main` object `o` through the public method `getPrivate()`. But in the console the result is ``` undefined ``` Why is the `_private` not returning the desired value?