[남숙희] Week4#150
Open
sooki88 wants to merge 11 commits into
Hidden character warning
The head ref may contain hidden characters: "part1-\ub0a8\uc219\ud76c-week4"
Open
Conversation
| @@ -0,0 +1,21 @@ | |||
| import { userPw } from "./signIn_pw.js"; | |||
| import { userEmail } from "./signIn_email.js"; | |||
Collaborator
There was a problem hiding this comment.
import { userEmail, resetErr, printErr } from "./signIn_email.js";
Collaborator
There was a problem hiding this comment.
resetErr, printErr 함수도 signIn_email.js 파일에서 export 되있는 상태이니 저렇게 적어주시고,
앞으로 js 파일명을 적으실때는 Camel Case, Snake Case 둘 중 하나로 통일해주세요.
| } | ||
|
|
||
| /* 이벤트 등록하기 */ | ||
| signInBtn.addEventListener( 'click', signInChk ); |
Collaborator
There was a problem hiding this comment.
굳이 두가지로 분리할 필요 없어 보입니다.
signInBtn.addEventListener( 'click', function(e) {
e.preventDefault();
signInChk();
});| function emailChk () { | ||
| let regex = new RegExp('[a-z0-9]+@[a-z]+\.[a-z]{2,3}'); | ||
|
|
||
| if( userEmail.value && !regex.test(userEmail.value) ){ |
Collaborator
There was a problem hiding this comment.
잘 생각해보시면 useEmail 값이 없을 때는 코드 자체를 실행시키지 않으면 됩니다.
그리고 regex 는 추가적으로 재선언이 일어나지 않는 변수이기 때문에 const 예약어로 선언해주세요.(+ 추가적으로 함수안에 있을 필요 없는 친구입니다.)
const regex = new RegExp('')
function emailChk() {
if(!userEmail.value) return;
if(!regex.test(userEmail.value)) {
// ....
}
}
Collaborator
Author
There was a problem hiding this comment.
아! return을 이렇게 사용할수도 있군요!
Collaborator
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요구사항
기본
심화
주요 변경사항
스크린샷
멘토에게