[javascript] Testing if value is a function