Skip to content

Instantly share code, notes, and snippets.

View vitorbal's full-sized avatar

Vitor Balocco vitorbal

View GitHub Profile

JavaScript

  • Explain event delegation
  • Explain how this works in JavaScript
  • Explain how prototypal inheritance works
  • How do you go about testing your JavaScript?
  • AMD vs. CommonJS?
  • Which JavaScript libraries have you used?
  • Have you ever looked at the source code of the libraries/frameworks you use?
  • What are undefined and undeclared variables?
  • What is a closure, and how/why would you use one?
@vitorbal
vitorbal / simplemoduleexport.js
Last active December 14, 2015 01:28 — forked from bryanberger/simplemoduleexport.js
Exporting pattern for scripts that supports both AMD and Node module patterns. Exports to `window` as a fallback.
(function( factory ) {
// if require js is available use it to define jquery and require it.
if ( typeof define === 'function' && define.amd ) {
define( ['jquery'], factory );
} else if ( typeof module !== 'undefined' && module.exports ) {
var jQuery = require('jquery');
module.exports = factory( $ );
} else {
window.YourModule = factory( $ );
}