알맹이방
[JavaScript] boolean return, null return 본문
function isLess(a, b){
return a<b;
}
console.log(isLess(10,15));
//return false
if(isLess(10,15))
console.log("true");
else
console.log("false");
function test(a, b){
if(a<0 || b<0)
return undefined;
return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}
console.log(test(-2,2));
//null return
'Study > Javascript' 카테고리의 다른 글
[JavaScript] 랜덤 숫자 (0) | 2021.10.06 |
---|---|
[JavaScript] Manipulating Complex Objects (0) | 2021.10.06 |
[JavaScript] 객체 생성 (Object) (0) | 2021.10.06 |
[JavaScript] switch (0) | 2021.10.06 |
[JavaScript] === (Strict equal) (0) | 2021.10.06 |
Comments