forEach는 return false가 안먹나?
본문 바로가기

Frontend

forEach는 return false가 안먹나?

			// 공백 체크
			const blankCheck = [
				title, writer, count, SGC, GHz, degree
			]

			for(let i = 0; i<blankCheck.length; i++){
				if(blankCheck[i].value == ''){
					alert('빈칸을 입력하세요');
					return false;
				}
			}

			// blankCheck.forEach((e, index)=>{
			// 	if(e.value == ''){
			// 		alert('빈칸을 입력하세요');
			// 		return false;
			// 	}
			// })
			// return true;

https://thiago6.tistory.com/209

반응형