Guest User

Untitled

a guest
Jan 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. function someObj() {
  2.  
  3. this.someMethod = function() {
  4. alert('boo');
  5. name = "someOtherMethod";
  6. window[name]();
  7. }
  8.  
  9. var someOtherMethod = function() {
  10. alert('indirect reference');
  11. }
  12.  
  13. }
  14.  
  15. function someObj() {
  16.  
  17. var methods = {};
  18.  
  19. methods.someMethod = function() {
  20. alert('boo');
  21. var name = "someOtherMethod";
  22. methods[name]();
  23. }
  24.  
  25. methods.someOtherMethod = function() {
  26. alert('indirect reference');
  27. }
  28.  
  29. }
  30.  
  31. function someObj() {
  32. this.someMethod = function() {
  33. alert('boo');
  34. name = "someOtherMethod";
  35. window[name]();
  36. }
  37. }
  38.  
  39. var someOtherMethod = function() {
  40. alert('indirect reference');
  41. }
  42.  
  43. function someObj() {
  44.  
  45. this.someMethod = function() {
  46. alert('boo');
  47. name = "someOtherMethod";
  48. methods[name]();
  49. }
  50.  
  51. var methods = {
  52. someOtherMethod : function() {
  53. alert('indirect reference');
  54. }
  55. };
  56. }
Add Comment
Please, Sign In to add comment