I don't understand why this doesn't work when the first value isn't available:
var borough = state.city.borough || 'Manhattan';
It returns:
Uncaught ReferenceError: state is not defined
I would expect it to default to Manhattan
when state.city.borough
isn't defined.
Edit: I am looking for a solution that will work if the "state" object or any of it's keys are not available.