Boris Raznikov
Boris Raznikov

Reputation: 2453

java script command line argument & map

I can't find in js how to find how many arguments where sent to the program (line in vb there is numberArg = WScript.Arguments.Count).

In addition I can't find a data structure like a map in js.

I searched the net and could n't find it.

Thanks

Upvotes: 0

Views: 106

Answers (2)

AlexR
AlexR

Reputation: 115398

in java script it is: WScript.Arguments.length.

Data structure like map is Object:

var map = new Object();
map["hello"] = "world";

Upvotes: 1

kan
kan

Reputation: 28981

Arguments.length is a size of array. Also look here for more cool stuff http://nilleb.wordpress.com/2008/08/27/javascript-code-to-use-wscript-parameters/

map is any object. E.g.

var mymap = {a:42, b:"hello world"}
alert(mymap.a)
alert(mymap['b'])

Upvotes: 1

Related Questions