HI,

I am new to javascript.. I have been given javascript code to understand as my assignment where i am working and it goes something like this :

PPL.getMarkup = function(a,b,c)
{
// definition goes here
}

I want the explaination for this line as to what PPL, getMarkup could be. I am confused as to PPL is a class or object or function.
Also, what are the different methods of defining class and functions in javascript?

Any help would be appreciated.
Thanks in advance,
VenusCrystal

If you don't know what the above is and it is part of your job to understand it, I would suggest reading "JavaScript, The Good Parts" by Douglas Crockford.

http://www.amazon.ca/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742/ref=sr_1_1?ie=UTF8&qid=1331554257&sr=8-1

And when you are done that (it's a short book), I would read "JavaScript, The Definitive Guide"

http://www.amazon.ca/gp/product/0596805527/ref=s9_simh_gw_p14_d0_g14_i3?pf_rd_m=A3DWYIK6Y9EEQB&pf_rd_s=center-2&pf_rd_r=0RDD0152H2PPFSC0MHX6&pf_rd_t=101&pf_rd_p=463383511&pf_rd_i=915398

PPL is more than likely an object with a function called getMarkup.

There are quite a few ways of writing this. One is as follows:

var PPL = {};

PPL.getMarkup = function(a,b,c){...};

//use
PPL.getMarkup(...);

or


var PPL = {
   getMarkup: function(a,b,c){
      ...
   }
};

//use
PPL.getMarkup(...);

or

//this is the closest to a standard class, the other are anonymous objects
function PPL(){
   this.getMarkup = function(a,b,c){
      ...
   };
}

//use
var obj = new PPL();

obj.getMarkup(...);

Hope this helps. Also, if there is an error that someone notices, please correct me.

commented: had a hard time getting vote up to work -they're using external scripts which were blocked by my system -cheers +8

Nope, you are correct all the way. :)

Thank you stbuchok.
Thanks for book suggestions.. will check on them .

If you don't know what the above is and it is part of your job to understand it, I would suggest reading "JavaScript, The Good Parts" by Douglas Crockford.

http://www.amazon.ca/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742/ref=sr_1_1?ie=UTF8&qid=1331554257&sr=8-1

And when you are done that (it's a short book), I would read "JavaScript, The Definitive Guide"

http://www.amazon.ca/gp/product/0596805527/ref=s9_simh_gw_p14_d0_g14_i3?pf_rd_m=A3DWYIK6Y9EEQB&pf_rd_s=center-2&pf_rd_r=0RDD0152H2PPFSC0MHX6&pf_rd_t=101&pf_rd_p=463383511&pf_rd_i=915398

PPL is more than likely an object with a function called getMarkup.

There are quite a few ways of writing this. One is as follows:

var PPL = {};

PPL.getMarkup = function(a,b,c){...};

//use
PPL.getMarkup(...);

or


var PPL = {
   getMarkup: function(a,b,c){
      ...
   }
};

//use
PPL.getMarkup(...);

or

//this is the closest to a standard class, the other are anonymous objects
function PPL(){
   this.getMarkup = function(a,b,c){
      ...
   };
}

//use
var obj = new PPL();

obj.getMarkup(...);

Hope this helps. Also, if there is an error that someone notices, please correct me.