Syntax help

Discussion in 'JavaScript' started by Script Kitty, Jul 10, 2010.

  1. #1
    Having a background of mostly pascal and c i went to the Javascript syntax page on Wikipedia and my mind exploded. I don't understand how variable declarations work without types

    I need to create an array of an object with several fields (one of them being an array of strings initialized to 0 elements), and a variable to accept a return value from a function that returns an array of strings.

    The data type i need with usage (in pseudo-code):

    type document is
    	string name = "";
    	string kind   = "";
    	string directory = "";
    	string system_id = "";
    	string schematic_id = "";
    	string[] associated_systems_ids;
    end type;
    document[] documents;
    documents.add("Joe","?","C:\","12","13",("9","8,"7"));
    documents.add("Bob","!","D:\","14","15",("6","5,"4","3"));
    Code (markup):
    The function with call (in pseudo-code):

    function foo() begin
    	string[] bar = "1","2","3";
    	return bar;
    end foo;
    string[] data = foo();
    Code (markup):
     
    Script Kitty, Jul 10, 2010 IP