Wednesday, 7 August 2013

Self-Executing JS Function

Self-Executing JS Function

I am doing the CodeAcademy JS training as a review for a course I'm taking
soon. I hit the creditCheck function exercise which basically just wants a
function that evaluates an integer and returns one value for above 100,
and one for below. I thought that the code below should work, but it is
running without being called. Why is this happening?
creditCheck = function(income)
{
if (income>100)
{
return(console.log("You earn a lot of money! You qualify for a
credit card."));
}
else
{
return(console.log("Alas you do not qualify for a credit card.
Capitalism is cruel like that."));
}
};

No comments:

Post a Comment