Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 46
  1. #31
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,297
    Thanks
    10
    Thanked 584 Times in 565 Posts
    Quote Originally Posted by DaveyErwin View Post
    The string is an object that has the ability to
    reveal its self as a string . It is always an object.
    ok, explain how these experiments confirm your theory:
    Code:
    var prim="dan";
    var obj= new String("dan");
    alert( prim === obj ); //false
    
    
    
    var prim2="dan";
    var obj2= "dan";
    alert(prim2===obj2); //true
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  2. #32
    Regular Coder
    Join Date
    Aug 2010
    Posts
    967
    Thanks
    19
    Thanked 211 Times in 209 Posts
    Quote Originally Posted by rnd me View Post
    ok, explain how these experiments confirm your theory:
    Code:
    var prim="dan";
    var obj= new String("dan");
    alert( prim === obj ); //false
    
    
    
    var prim2="dan";
    var obj2= "dan";
    alert(prim2===obj2); //true
    The false is because they are different objects
    The true is because prim2 and obj2 are refferencing the same object

    Thanks for providing proof for my position.

  3. #33
    Regular Coder
    Join Date
    Aug 2010
    Posts
    967
    Thanks
    19
    Thanked 211 Times in 209 Posts
    Quote Originally Posted by Old Pedant View Post
    LOL!!! See, I *told* you, RndMe. He is *NOT* going to be convinced!

    I love it.
    Well the code he posted has convinced me that everything is an object in javascript.

    Quote Originally Posted by Old Pedant View Post
    No. That paragraph is two short sentences long. It's all relevant. Read it.

    I'm not continuing this thread.

  4. #34
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,253
    Thanks
    12
    Thanked 341 Times in 337 Posts
    Quote Originally Posted by DaveyErwin View Post
    Well the code he posted has convinced me that everything is an object in javascript.
    that finally convinces me that you have no idea of object or JavaScript object handling.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  5. #35
    Regular Coder
    Join Date
    Aug 2010
    Posts
    967
    Thanks
    19
    Thanked 211 Times in 209 Posts
    No need to get snipitty.
    Would you be inclined to elaborate on object handling?

  6. #36
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,253
    Thanks
    12
    Thanked 341 Times in 337 Posts
    there’s no point in doing that. you wouldn’t understand anyway.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  7. #37
    Regular Coder
    Join Date
    Aug 2010
    Posts
    967
    Thanks
    19
    Thanked 211 Times in 209 Posts

    Question

    Quote Originally Posted by Dormilich View Post
    there’s no point in doing that. you wouldn’t understand anyway.
    Possibly you will enumerate this thinds ?

  8. #38
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,297
    Thanks
    10
    Thanked 584 Times in 565 Posts
    Quote Originally Posted by DaveyErwin View Post
    The true is because prim2 and obj2 are refferencing the same object

    Thanks for providing proof for my position.
    Code:
    var prim2="dan";
    var obj2= "dan";
    
    prim2.dan="fred";
    alert(prim2.dan)
    how do you know are prim2 and obj2 are really the same object?
    also, why won't the prim2 object accept the dan property (like all other objects do)?

    here is a real string object, notice how it behaves:
    Code:
    var obj=new String("dan");
    obj.dan="fred";
    
    alert(obj.dan)
    not sure why you are so adamantly ignorant.
    personally, when i have several senior coders all telling me the same thing i tend to listen or at least read the links they post.
    Last edited by rnd me; 09-02-2010 at 08:19 PM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  9. #39
    Regular Coder
    Join Date
    Aug 2010
    Posts
    967
    Thanks
    19
    Thanked 211 Times in 209 Posts
    Quote Originally Posted by rnd me View Post
    Code:
    var prim2="dan";
    var obj2= "dan";
    
    prim2.dan="fred";
    alert(prim2.dan)
    how do you know are prim2 and obj2 the same object?

    Because ...

    Code:
    var prim2="dan";
    var obj2= "dan";
    alert(prim2===obj2); //true
    Quote Originally Posted by rnd me View Post
    also, why won't the prim2 object accept the dan property (like all other objects do)?
    I can't get what accept is ?
    You don't seem to be very good at asking questions.

    Quote Originally Posted by rnd me View Post
    here is a real string object, notice how it behaves:
    Code:
    var obj=new String("dan");
    obj.dan="fred";
    
    alert(obj.dan)
    Yes, I am very aware of how objects behave,
    but i would like some commentary on object handling.

  10. #40
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,297
    Thanks
    10
    Thanked 584 Times in 565 Posts
    Quote Originally Posted by DaveyErwin View Post

    Code:
    var prim2="dan";
    var obj2= "dan";
    alert(prim2===obj2); //true
    I can't get what accept is ?
    You don't seem to be very good at asking questions.
    you're even worse at answering them
    I'm asking why does the alert show "undefined" when asking for the "dan" property of prim2 in the following code:

    Code:
    var prim2="dan";
    var obj2= "dan";
    
    prim2.dan="fred";
    alert(prim2.dan); //shows undefined
    All objects (except null) can store properties.
    prim2 cannot store a property.
    therefore, prim2 is not an object.



    furthermore,
    since objects are assessed by reference,
    if prim2 and obj2 are the same object
    altering one would alter the other:

    Code:
    var prim2="dan";
    var obj2= "dan";
    
    prim2+=" more text";
    alert(prim2===obj2);//false
    altering prim2 had no effect on obj2.
    therefore, prim2 or obj2 (or both) are not objects.

    what is your specific question about object handling?
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  11. #41
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,193
    Thanks
    75
    Thanked 4,341 Times in 4,307 Posts
    I know I'm going to regret this...

    Even more clearly than *this* failing:
    Code:
    var prim2="dan";
    prim2.dan="fred";
    would be this:
    Code:
    "dan".whatever = "fred";
    If a literal string is an object, that should work. Clearly it doesn't. Clearly a literal string is not an object.

    You have MUCH more patience than I do, RndMe.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  12. #42
    Regular Coder
    Join Date
    Aug 2010
    Posts
    967
    Thanks
    19
    Thanked 211 Times in 209 Posts
    Quote Originally Posted by rnd me View Post
    All objects (except null) can store properties.
    You are getting very close now.

    Code:
    a = null;
    alert(a == 'null');
    alert(null)
    alert(a)

  13. #43
    Regular Coder
    Join Date
    Aug 2010
    Posts
    967
    Thanks
    19
    Thanked 211 Times in 209 Posts
    Quote Originally Posted by Old Pedant View Post
    I know I'm going to regret this...

    Quote Originally Posted by Old Pedant View Post

    I'm not continuing this thread.

  14. #44
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,253
    Thanks
    12
    Thanked 341 Times in 337 Posts
    Quote Originally Posted by DaveyErwin View Post
    Code:
    a = null;
    alert(a == 'null');
    alert(null)
    alert(a)
    what should that prove?
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  15. #45
    Regular Coder
    Join Date
    Aug 2010
    Posts
    967
    Thanks
    19
    Thanked 211 Times in 209 Posts
    Quote Originally Posted by Dormilich View Post
    what should that prove?
    Does it say any thing at all to you ?


 
Page 3 of 4 FirstFirst 1234 LastLast

Tags for this Thread

Posting Permissions

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