...

View Full Version : Are there such things as pointers in Javascript?



DH2006
06-06-2007, 07:03 PM
Hi!
Are there pointers in Javascript available, like for example in Turbo Pascal 7? :)

So i could use

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

GJay
06-06-2007, 08:02 PM
as you can pass the function, why would you need a pointer to it? What would happen when it, rather than 'itself' is called?

liorean
06-06-2007, 11:17 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum