PHP에서 우리가 어떤 일을 잘못했을 때 커밋 된 행 번호와 함께 오류가 표시됩니다. 난 당신이 내 코드에서 이해 자바 스크립트에서이 같은 원하는 : 보안이 "h"
또는 "l"
아닌 다음 당신이 볼 수있는 예외가 발생하는 경우 실수가있는 줄을 어떻게 알 수 있습니까?
var varlist = {};
var private = {
str : function(nameArg, valueArg, security){
if (varlist.hasOwnProperty(nameArg) === true){
throw "Variable Existance : variable "+nameArg +" is already exist in your variable list and cannot be overwritten in private type";
}else if(security === "h"){
var stre = String(valueArg);
var strnew = stre.replace(/\d/g, "");
varlist[nameArg] = strnew;
}else if(security === "l"){
varlist[nameArg] = String(valueArg);
}else if(security !== "h" || security !== "n"){
varlist[nameArg] = String(valueArg);
throw "Unexpected Security Level: Entered " +security+" is unexpected and the default security level is low(l)";
}
}
}
이제 마지막
throw
문 봐. 코드 편집기에서 줄을 90이라고 말하면,
"o"
이 유효하지 않은 곳에서
private.str("abc",9000,"o");
을 작성합니다. 그래서 자바 스크립트
private.str("abc",9000,"o");
이 기록 된 그 라인을 찾은 다음
"Unexpected Security Level: Entered " +security+" is unexpected on line "+line_number+" and the default security level is low(l)";
을 던져 여기 예를 들어
line_number
는 90 그래서 자바 스크립트 내가이 검색을 시도
"Unexpected Security Level: Entered o is unexpected on line 90 and the default security level is low(l)";
이 문을 던져해야하지만 아무도 지식
내 범위에서 도울 수 있어야감사합니다.
'indiexOf'가 정의되어 있지 않습니다. js 콘솔 및 Google 콘솔 – anni
은 line.indexOf이어야합니다. – aelgoa