www.webdeveloper.com
Results 1 to 2 of 2

Thread: Referring itself

  1. #1
    Join Date
    Apr 2011
    Posts
    27

    Referring itself

    Hi all,
    How can an array element refer itself? Suppose I have an array like this,

    var a=[[1,2,{f:function(){var b=a[0][1];}}],
    [9,10,{f:function(){myself[1]===10?...}}]]

    So in function f, how can i change the assignment line to something like
    var b=this_array_element[1] dynamically or there is a way doing so?

    TIA
    -s

  2. #2
    Join Date
    Jan 2009
    Location
    Insanity
    Posts
    1,131
    Well I don't know myself but your using var and not returning anything from the function.

    I would have thought that
    Code:
    var a=[[1,2,{f:function(){ b=this[0][1];}}],
     ...
    would have had some part to play in the process.

    I suggest you start with that idea and play around until you his the mark. I still think that you should be returning a value but thats only my thoughts.
    We all have baggage to carry in life, unfortunately for me I always get the trolley with the wonky wheel...
    Code:
    Youre = {
          STILL_not_getting_it:function(){
               alert("YOU, the original poster / thread starter NEED to POST the code and NOT a LINK.");
          },
          MissingThePoint:function(msg){
                alert("You're missing the point. " + msg);
          }
    }
    Youre.STILL_not_getting_it();

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles