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.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2006
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Are there such things as pointers in Javascript?

    Hi!
    Are there pointers in Javascript available, like for example in Turbo Pascal 7?

    So i could use
    Code:
    function TestFunc(PointerToFunctionA, FunctionAItself) {
      FunctionAItself('Hallo'));
     //And how to use the Pointer then?
     PointerToFunction('Hallo')...???
    }
    function PassedFunction(TextToShow) { alert(TextToShow); }
    
    TestFunc(^PassedFunction,PassedFunction);
    Greetings
    Dieter

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    as you can pass the function, why would you need a pointer to it? What would happen when it, rather than 'itself' is called?
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #3
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Quote Originally Posted by DH2006 View Post
    Are there pointers in Javascript available, like for example in Turbo Pascal 7?
    Strictly speaking, no. Not in the sense of 32 bit integers specifying an address in memory, no.

    However, JavaScript has primitive types (or value types) and compound types (or reference types). Functions are reference types, and can be handled with just like any other reference type.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    Posting Permissions

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