Skip to content

Instantly share code, notes, and snippets.

@martypdx
Created August 9, 2016 20:58
Show Gist options
  • Save martypdx/7c64a75a493b9c62a5a0cbd47d4b7060 to your computer and use it in GitHub Desktop.
Save martypdx/7c64a75a493b9c62a5a0cbd47d4b7060 to your computer and use it in GitHub Desktop.

control flow

  • if, else, while, for, do

functions

closures

```js
var a = 'foo';
function b(){
	return a;
}
b();
```

"this" keyword

functional programming

  • array methods: .filter, .map, .reduce, .find, etc.

objects

Constuctor functions

```js
function Foo(){}
Foo.prototype.bar = function(){}
var foo = new Foo();
```

Object literals

```js
var foo = {
	bar: 'bar'
};
```

Objects as hashes/dictionaries

```js
var items = {};

function add( key, value ) {
	items[key] = value;
}

function get( key ) {
	return items[key];
}

function exists( key ) {
	return !!items[key];
}

function remove( key ) {
	delete item[key];
}

```

ES6 (ES2015)

Fat arrows

Practice Javascript

Codewars

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment