Search code examples
javascriptnotation

What does comma mean after javascript object declaration?


Let's take some javascript code from vk.com

var stManager = {

   //some long code with methods and properties...

}, __stm = stManager;

Why do we need last line in this code? Why duplicate stManager one more time?


Solution

  • It means you are declaring another variable. Just a different notation. It is the same as:

    var stManager = {};
    var _stm = stManager;