I don’t understand how work an object with Jquery/javascript.
And how create a private method/variable with? i see on the forum a closure but i have try and not work. And how see if the method/variable is private? because when I run the website, I see always the function and variable with the own value into my script…
Thanks for your help :).
By e.x:
var ClassName=function()
{
validation : 0,
name : 0,
privateVar: 0,
init : function ()
{
validation = 1;
name ="toto";
}
privatefunction :function()
{
alert("a private function");
}
};
Heres one of the multiple ways to have OOP in Javascript
Javascript is not Class based, but prototype based. There are not class**, but instances that can be decorated or used as template to build new instances. This code I have write here have all the proporties of a Class, but is just a instance.
** this is a lie