0

I deal with multiple languages, so I'm always hunting for how to do

var x = [1,2,3,4];
len(x);     // No, python
x.size;     // No, javascript?
x.size();   // Still no, uh Java?
x.length(); // Grrr
size(x);    // Think that one is C, right?

Which one is it? And how does it change for arrays again? The array page could use an example.

Brian Dolan
  • 3,086
  • 2
  • 24
  • 35

1 Answers1

2

The correct answer is javascript:

var x = [1,2,3,4];
writeln(x.size);

For completeness, here is a summary of the built-in types with size-like fields:

ben-albrecht
  • 1,785
  • 10
  • 23