Mercurial > js4py
view core-javascript/exercise-1.rst @ 213:0ea90a1819c2 default tip
Custom theming
| author | Radomir Dopieralski <radomir.dopieralski@allegro.pl> |
|---|---|
| date | Wed, 27 Jun 2012 16:35:54 +0200 |
| parents | 58e4f484903f |
| children |
line wrap: on
line source
Exercise one ============ Here's some JavaScript code I found somewhere. I've changed the names of everything to hide the origin of the code. But it's not something I've made up. The exercise is #. Understand and describe what it does. #. Provide clearer code that does the same thing. #. Suggest a better way of going about things. .. literalinclude:: /core-javascript-work/exercise-1.js :language: javascript Hints ----- #. The code creates and calls an anonymous function, a bit like this. .. code-block:: javascript js> a = function(x){return x + 1}(2) 3 #. What happens if AAA is an object? #. What happens if AAA is undefined? #. For now, ignore the assignment to BBB.fff. What value does AAA get? (The answer depends the initial value of AAA.)
