1
보통 널 (null)로 클래스/수익을 종료하지만, 사실 전 C#의 지식을 가진 초보자 오전, JS에서이 작업을 수행하는 방법을 모르는 방법 -하지 JS이 NullReferenceException이 보이는 것이 다른 언어
<script>
var x = new fooClass(null);
function fooClass(foo)
{
if(foo===null)
return; // The return type is "fooClass"
// I want to return something that will tell that the
// class were wrong initialized, maybe exception?
alert(foo); // show that the script continues
}
</script>
이 내가보기 나는이 시도 캐치로 지금 노력하고, 전체 페이지에 JS 실행을 중단 실제로 : 그것은 질문 –
을 형성 내 잘못의 뜻 항상 [오류'던짐] (http://www.devthought.com/2011/12/22/a-string-is-not-an-error/)! – Bergi