0

私は基本的に以下のコードを機能させたいのですが、方法はありますか?

var hash_table = new Object();
hash_table['a'] = foo;
alert(hash_table['a'](1)); // 1 is just a simple parameter for example.
                           // this line should print "2" in alert();.


function foo(params) {
    alert("params: " + params); // just simple print in alert(); (will print 1)
    return 2;
}
4

2 に答える 2