javascript object help
<p>I'm following a tutorial on how to make a javascript game, but i'm stuck on the return part. Why are is there { }, and what is the init: init for? Any help would be appreciated. Thanks.</p>

<pre><code>var JS_SNAKE = {};

JS_SNAKE.game = (function () {
  var ctx;
  var xPosition = 0;
  var yPosition = 0;
  var frameLength = 500; //new frame every 0.5 seconds

  function init() {
    $('body').append('&lt;canvas id="jsSnake"&gt;');
    var $canvas = $('#jsSnake');
    $canvas.attr('width', 100);
    $canvas.attr('height', 100);
    var canvas = $canvas[0];
    ctx = canvas.getContext('2d');
    gameLoop();
  }

  function gameLoop() {
    xPosition += 2;
    yPosition += 4;
    ctx.clearRect(0, 0, 100, 100); //clear the canvas
    ctx.fillStyle = '#fe57a1';
    ctx.fillRect(xPosition, yPosition, 30, 50); //a moving rect
    setTimeout(gameLoop, frameLength); //do it all again
  }

  return {
    init: init
  };
})();


$(document).ready(function () {
  JS_SNAKE.game.init();
});
</code></pre>
