Javascript Check If Function Exists From String To Int