Skip to content

Instantly share code, notes, and snippets.

View brianfajardo's full-sized avatar
🇨🇦
Live long and prosper

Brian Fajardo brianfajardo

🇨🇦
Live long and prosper
  • Breathe Life
  • Canada
View GitHub Profile
@brianfajardo
brianfajardo / gist:446979edf3896d6c5d405329cd91bdf6
Created September 4, 2017 21:18
JavaScript: Classes, Constructors, Function Factories
// These are examples of prototypical inheritance found in JavaScript.
// ES6 Class
class ClassAnimal {
speak(){ console.log('woof') }
}
const doggie = new ClassAnimal()
const posts = [
{ id: 1, likes: [] },
{ id: 2, likes: ['Peter'] },
{ id: 3, likes: ['John', 'Mark'] },
{ id: 4, likes: ['Brian', 'Brandon', 'Kim'] },
{ id: 5, likes: ['Julie', 'Jane', 'Bran', 'Jimmy'] }
]
const swagModule = () => {
0x3DE933dED53E2B94d4AF8412580858bcB2dA81Fd
0x6317a4bfb778b7cfd3eaf327bf69d7c3658c94d9
function runWithDebugger(callback, optionalArgsArray) {
if (arguments.length === 0){
console.log('Must pass at least one argument to this function.');
return;
}
debugger;
callback.apply(this, optionalArgsArray);
};
function sayFullName(first, last) {