我在網上學習JavaScript造成的錯誤,我停留在一個點,我需要調用一個函數功能在javascript
var creditCheck = function (income)
{
if (income>=100)
{
return console.log("You earn a lot of money! You qulaify for a credit card.");
}
else {
return console.log("Alas yo do not qualify for credit card. Capitalism is creul like that.");
}
};
creditCheck(75);
以上是我的代碼在我打電話的creditCheck
功能。現在當我把75的功能參數else
命令(即"Alas yo do not qualify for credit card. Capitalism is creul like that."
)在控制檯中執行兩次。
爲什麼此文本在控制檯中出現兩次?
感謝
只出現在這裏一次。 –
工作完美 - > http://jsfiddle.net/2JT37/ – adeneo
爲什麼你要返回'console.log'? – tewathia