Commas in Javascript
javascript
Solution
This way you declare an object:
var contactForm = {
// properties:
property1 : value,
property2 : value,
property3 : value,
// methods:
method1 : function() {
// ...
},
method2 : function() {
// ...
}
};
You can find more information about JavaScript objects in MDN ...and in the comments below :)
Problem
``` <script> (function() { $('html').addClass('js'); var contactForm = { container: $('#contact'), <-- THIS COMMA init: function() { $('<button></button>', { text: 'Contact Me' }) .insertAfter('article:first') .on('click', this.show); }, <---------------------------------- AND THIS COMMA show: function() { contactForm.container.show(); } }; contactForm.init(); })(); </script> ``` In the above script, I noticed: `container: $('#contact'),` Is that one way to declare a variable? Doing the following breaks the script: `var container = $('#contact');` Also, what is with the commas after the init function and the container variable (if it is a variable)?