-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[남숙희] Week4 #150
base: part1-남숙희
Are you sure you want to change the base?
The head ref may contain hidden characters: "part1-\uB0A8\uC219\uD76C-week4"
[남숙희] Week4 #150
Conversation
@@ -0,0 +1,21 @@ | |||
import { userPw } from "./signIn_pw.js"; | |||
import { userEmail } from "./signIn_email.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { userEmail, resetErr, printErr } from "./signIn_email.js";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resetErr
, printErr
함수도 signIn_email.js
파일에서 export 되있는 상태이니 저렇게 적어주시고,
앞으로 js 파일명을 적으실때는 Camel Case
, Snake Case
둘 중 하나로 통일해주세요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
파일명 통일하겠습니다!
} | ||
|
||
/* 이벤트 등록하기 */ | ||
signInBtn.addEventListener( 'click', signInChk ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굳이 두가지로 분리할 필요 없어 보입니다.
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) ){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
잘 생각해보시면 useEmail
값이 없을 때는 코드 자체를 실행시키지 않으면 됩니다.
그리고 regex
는 추가적으로 재선언이 일어나지 않는 변수이기 때문에 const
예약어로 선언해주세요.(+ 추가적으로 함수안에 있을 필요 없는 친구입니다.)
const regex = new RegExp('')
function emailChk() {
if(!userEmail.value) return;
if(!regex.test(userEmail.value)) {
// ....
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아! return을 이렇게 사용할수도 있군요!
|
요구사항
기본
심화
주요 변경사항
스크린샷
멘토에게