Created
September 10, 2011 22:08
-
-
Save pragmaticobjects/1208863 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var tax= 0.08; | |
| var fee = 10; | |
| var sinTax = 0.02; | |
| (function f(item, price) { | |
| var h = { | |
| 'gas': function() { | |
| var total = price + price*tax + fee; | |
| alert(total); | |
| }, | |
| 'wine': function() { | |
| var total = price + price*tax + price*sinTax; | |
| alert(total); | |
| } | |
| }; | |
| typeof h[item] == 'undefined' ? | |
| (function() { | |
| var total = price + price*tax; | |
| alert(total); | |
| })() : h[item](); | |
| })('milk', 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment