我想从对象执行javascript,但不知道如何调用
例如,如果我execute makeFunctionCall('/version/get')
应该返回"v1.0"
function makeFunctionCall(functionCall){
if(currentTicket == ""){ getTicket() }
else{
var _functionCall = functionCall
while(_functionCall.charAt(0)=='/'){_functionCall.substr(1)}
_functionCall = _functionCall.split('/')
// I dont know how to call function from that object dynamicly
}
}
var functionObject = {
version: {
get: ()=>{
return "v1.0"
}
}
}
答案 0 :(得分:-1)