itpastorn/programmering-1-med-js — Issue #5: clarify function declarations disallowed in blocks
Author: Raynos
Created: 2012-01-13 00:14:03+00:00
State: open

> Quirk #n: Function expressions
> Are available
> Must be used when assignment is conditional

It's not that function expressions must be used when assignment is conditional, it's that function declarations must not be used in blocks.

Note function declarations can still be used when assignment is conditional.

For example

```
function returnBasedOnBool(bool) {
if (bool) {
return _true;
} else {
return _false;
}

function _true() { return true; }
function _false() { return false; }
}
```