Im learning javascript and I just dont understand what this javascript syntax actually means…
Comment = function () {
}
I know that in this context we use it to define an object but what is the stucture called where can I read about it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You are defining a function named
Comment, this is equivalent to:Because there is now
varkeyword like here:the
Commentvariable will be added to global object calledwindow, so it is equivalent to:Also, by convention, capitalized function names are used for so called constructors: