We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpProcessing Implementations › processing.js aray functions
Page Index Toggle Pages: 1
processing.js aray functions? (Read 1590 times)
processing.js aray functions?
Jul 10th, 2008, 5:43am
 
Does processing.js include any of the array processing functions?  It gives me an error if I use append() or subset()

thanks,
Cliff
Re: processing.js aray functions?
Reply #1 - Jul 10th, 2008, 8:12am
 
You should ask this kind of question to the author of Processing.js...
Beside, JavaScript have a more flexible array system than Java, growing automatically when needed, so perhaps the author just omitted this feature.

Excerpt from a test code I wrote (in TestJSArray):
Code:
// Simple definition and putting values in it
var simpleArray = new Array();
simpleArray[0] = "GET";
simpleArray[1] = "POST";
simpleArray[2] = "PUT";
simpleArray[3] = "DELETE";

// Pre-definition and initialization with an array literal
var predefinedArray = new Array(5);
var i = 0;
predefinedArray[i++] = "HTTP";
predefinedArray[i++] = "FTP";
predefinedArray[i++] = "NNTP";
predefinedArray[i++] = "IRC";
// We are not limited to the predefined size
// Slots 4 and 5 are empty
predefinedArray[i + 2] = "FTPS";

// Definition and initialization at once
var initializedArray1 = [ "html", "head", "body", ]; // Trailing comma is OK
// This form must have at least two elements to distinguish from pre-definition
var initializedArray2 = new Array("html", "head", "body");
Page Index Toggle Pages: 1