Skip to content

Instantly share code, notes, and snippets.

@anselmdk anselmdk/es6-classes.md
Last active Dec 20, 2016

Embed
What would you like to do?
JavaScript Cheat Sheet

ES6 Classes

Parent:

class Parent {
  constructor(vars) {
    //doing some grown up stuff
  }
}
export default Parent;

Child:

class Child extends Parent {
  constructor(vars) {
    super(vars);
    //doing some child stuff
  }
}

export default Child;

JavaScript Cheat Sheet

Timeout

setTimeout(function(){ alert("Hello"); }, 3000);

Looping

//arrays
arr.map(function(obj){ 
  console.log(obj);
});
//objects
Object.keys(obj).map(function(value, index) {
   console.log(obj[value])
});
//or
for(var key in obj) {
    if(obj.hasOwnProperty(key)) {
        console.log(obj[key]);
    }
}


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.