Javascript Check If Variable Is Function