diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index 141f933..cf543e8 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -154,3 +154,10 @@ snippet sing return instance; } +# Crockford's object function +snippet obj + object(o) { + function F() {} + F.prototype = o; + return new F(); + }