IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
To/From Code
-Collapse +Expand Cross Ref Guide
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesJavaScriptData Structures  Print This     

Cross Ref > Data Structures

By Mike Prestwood

JavaScript versus Delphi Prism: A side by side comparison between JavaScript and Delphi Prism.

 
Data Structures
 

Data structures allow you to store and work with data. Common data structures include arrays, associative arrays, etc.

Associative Array

[Other Languages] 
A set of unique keys linked to a set of values. Each unique key is associated with a value. Think of it as a two column table. MyArray['CA'] = 'California' MyArray['AR'] = 'Arizona'

Languages Focus

Associative arrays are also known as a dictionary or a hash table in other languages.

JavaScript:   Array(), use [
Syntax Example:
var MyStateList= new Array()
MyStateList["CA"]="California";
MyStateList["OR"]="Oregon";
Alert("OR is " + MyStateList["OR"])
[Not specified yet. Coming...]




Pointers

[Other Languages] 

General Info: Pointers / References

A pointer is a variable type that allows you to refer indirectly to another object. Instead of holding data, a pointer holds the address to data -- the address of another variable or object. You can change the address value a pointer points to thus changing the variable or object the pointer is pointing to.

A reference is a type of pointer that cannot change and it must always point to a valid storage (no nulls).

JavaScript:   Not Supported

JavaScript does not offer developer defined pointers. However, you can use the eval function to simulate pointers.

Delphi Prism: 

Although pointer data types in Prism coding are less important than in other languages such as C++, Prism does support developer defined pointers. Use the ^ operator to declare a pointer data type. Use the @ operator to return the current address of a variable.

In .Net managed coding the use of pointers is not safe because the garbage collector may move memory around. To safely use pointers, use the unsafe keyword. However, avoid unsafe code if possible.

More Info / Comment




Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]