Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <div class="content"></div>
</body>
</html>
 
var App = (function ($) {
    var defaults = {
        navigation: "nav",
        footer : "foot"
    };
  
    var Website = function (options) {
      this.options = $.extend({}, defaults, options);
        this.echo =  function (message) {
            console.log(message);
        };
    };
    var Events = function (options) {
        
      this.options = $.extend({}, defaults, options);
        this.echoTwo = function (message) {
            console.log(message + message);
        };
    };
    return {
        Website: Website,
        Events: Events
    };
}(jQuery));
var website = new App.Website({navigation: "changed"});
website.echo(website.options.navigation + ' '+ website.options.footer);
var events = new App.Events({footer: "bar"});
events.echoTwo(events.options.navigation + ' '+ events.options.footer);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
NickTomlinpro
0viewers