开发者

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'])
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜