www.webdeveloper.com

Search:

Type: Posts; User: goldfidget

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    1,345

    The idea is that the scope object is created when...

    The idea is that the scope object is created when a function is run. The scope chain pointer is instantiated when a function is created, and is then immutable. When accessing a local variable the...
  2. Replies
    2
    Views
    1,345

    Comments on Closure

    Hi,

    Thanks to everyone for answering all my dumb questions about scope, and for helping me to overcome my Java mentality. I've been thinking a fair bit about scope and closure, and I wanted to...
  3. Replies
    21
    Views
    2,682

    Thank you both, that was very helpful :)

    Thank you both, that was very helpful :)
  4. Replies
    21
    Views
    2,682

    So, given the above, is there a way for a...

    So, given the above, is there a way for a function to refer to itself outside of a constructor without necessarily knowing its own name?
  5. Replies
    21
    Views
    2,682

    Ahhhh, ahhhh, yes wonderful :)

    Ahhhh, ahhhh, yes wonderful :)
  6. Replies
    21
    Views
    2,682

    Ah, sorry, I missed your link. Functions are...

    Ah, sorry, I missed your link. Functions are objects, string literals are not. :)
  7. Replies
    21
    Views
    2,682

    Ah I see, that makes sense. The code is not...

    Ah I see, that makes sense. The code is not evaluated until the function is run, so until I call fnc(), fnc.c does not exist...
  8. Replies
    21
    Views
    2,682

    Ah, that's interesting, the String constructor...

    Ah, that's interesting, the String constructor wraps a string primitive in an object.

    The primitive still has methods though, I can do this:


    alert("Hello".charAt(2));
    => l
  9. Replies
    21
    Views
    2,682

    Thanks Kor, My assumption, coming from Ruby,...

    Thanks Kor,

    My assumption, coming from Ruby, was that functions are a type of object.


    var str = "Hello";
    str.a = "Hi There";
    alert(str.a);
    // => undefined
  10. Replies
    21
    Views
    2,682

    Thanks skinicod, As far as I can see though,...

    Thanks skinicod,

    As far as I can see though, fnc is and remains a variable of type function. If I do:



    var fnc = function() {
    }
    fnc.c = 4
    alert(fnc)
  11. Replies
    21
    Views
    2,682

    Also, is there a way to declare a such that it is...

    Also, is there a way to declare a such that it is accessible from fnc.a?
  12. Replies
    21
    Views
    2,682

    Another dumb question about scope

    Hi there,

    Sorry for the dumb question, I've been googling all over and I can't find an answer to ths.

    I notice that if I do this:


    var fnc = function() {
    var a = 10;
    fnc.b = 10;
  13. Replies
    22
    Views
    5,905

    I was thinking about this last night. It seems to...

    I was thinking about this last night. It seems to me that one good thing about not making prototype writable is that it absolutely guarantees that there will be no cycles in the inheritance graph...
  14. Replies
    22
    Views
    5,905

    This is a nice syntax, as it lets you declare the...

    This is a nice syntax, as it lets you declare the whole inheritance hierarchy in litereals. From what I can see, it appears to work in Webkit and Gecko, but not IE or Opera.

    Just out of interest,...
  15. Replies
    22
    Views
    5,905

    Ah, and this is actually a lot nicer than...

    Ah, and this is actually a lot nicer than Crockford's naked object() function solution. So if I'm getting this correctly you should be able to just extend the Object object to give everything the...
  16. Replies
    22
    Views
    5,905

    I thought that you could set the prototype object...

    I thought that you could set the prototype object directly on any object, but I see from Crockford that you can only set it when calling a method as a constructor using the new keyword. To accomplish...
  17. Replies
    22
    Views
    5,905

    Ah yes, you're right. prototype is instantiated...

    Ah yes, you're right. prototype is instantiated as a custom property. One thing still bothers me, and sorry again for the silly questions. What is the purpose of the new operator here? I would have...
  18. Replies
    22
    Views
    5,905

    Ah, this is where I come unstuck, I'm a Java/Ruby...

    Ah, this is where I come unstuck, I'm a Java/Ruby developer so do please bear with me. In Java, everything eventualy inherits from the Object class.

    My assumption was that, since I haven't...
  19. Replies
    22
    Views
    5,905

    Object literals and inheritance

    Hi all, sorry for the newbie question. I really love the way Javascript objects inherit directly from other objects, rather than via a class structure. It seems lie a much more sensible way of doing...
Results 1 to 19 of 19
HTML5 Development Center



Recent Articles