开发者

java script command line argument & map

开发者 https://www.devze.com 2023-03-25 18:12 出处:网络
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).

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

精彩评论

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

关注公众号