Question: Python's get method for dictionaries lets me specify what should be returned if a key doesn't exist. For my current case I want a dictionary returned. How do I do this in Javascript?

Answer: 
There is no javascript equivalent of the python dictionary get method. If you would write it yourself, as a function, it would look like this:

```
function get(object, key, default_value) {
    var result = object[key];
    return (typeof result !== "undefined") ? result : default_value;
}

```

Use it like:

```
var obj = {"a": 1};
get(obj, "a", 2); // -> 1
get(obj, "b", 2); // -> 2

```

Note that the requested key will also be found in a prototype of obj.

If you really want a method rather than a function (`obj.get("a", 2)`), you need to extend the prototype of Object. This is generally considered a bad idea though, see [Extending Object.prototype JavaScript](https://stackoverflow.com/questions/6877005/extending-object-prototype-javascript)
I prefer to use the logical OR like this:

```
foo.bar || 'default'

```

If checks is foo.bar is falsy, so it returns 'default' if bar is undefined.

You just need to care, that foo is an object. Otherwise a ReferenceError is thrown.