Skip to content

Instantly share code, notes, and snippets.

@andrewebdev
Last active December 17, 2015 10:19
Show Gist options
  • Save andrewebdev/5593576 to your computer and use it in GitHub Desktop.
Save andrewebdev/5593576 to your computer and use it in GitHub Desktop.
Javascript: Object
function JSObject(options) {
var self = this,
defaultOptions = {
target: '#selector' // The target container selector
};
// Extend the options, required to prepare this object before doing anything else.
if (typeof options === 'object') {
options = $.extend(defaultOptions, options);
} else {
options = defaultOptions;
}
// Private methods
function init(index) {
}
// Public methods
this.hello = function() {
console.log("Hello, World!");
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment