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 f开发者_运维百科ind it.
Thanks
in java script it is: WScript.Arguments.length
.
Data structure like map is Object:
var map = new Object();
map["hello"] = "world";
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'])
精彩评论