Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Best JavaScript quiz I have created so far :-)
- */
- var someObject = {
- foo: function() {
- /* ... */
- },
- bar: function() {
- /* ... */
- }
- };
- var test = Math.random() > 0.5;
- /*
- Question: What is the difference between the following calls?
- */
- someObject[test ? "foo" : "bar"]();
- (test ? someObject.foo : someObject.bar)();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement