Skip to content

Instantly share code, notes, and snippets.

@radzionc
Last active September 10, 2017 10:40
Show Gist options
  • Save radzionc/fa145857869bd1c464489ae510f428a2 to your computer and use it in GitHub Desktop.
Save radzionc/fa145857869bd1c464489ae510f428a2 to your computer and use it in GitHub Desktop.
const create = (proto, props) =>
Object.assign(Object.create(proto), props)
const Vector2D = (x, y) => create({
}, {
x,
y,
length: Math.hypot(x, y)
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment