I’ve created this utility method in JS:
function IsAuthenticated(userID)
{
var isAuthed = false;
if (userID.length == 0)
return false;
// more logic
if(SomeLogic)
isAuthed = true;
return isAuthed;
}
When I run something like this, I’m getting an object back rather than type bool:
if(IsAuthenticated)
//code here
I assume I need to cast it to a bool?
IsAuthenticatedrefers to the function with the name “IsAuthenticated” and is not a function call. If you use thetypeofoperator onIsAuthenticatedyou will get"function":So try this instead: