-
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
[박운성] week5 #217
base: part1-박운성
Are you sure you want to change the base?
The head ref may contain hidden characters: "part1-\uBC15\uC6B4\uC131-week5"
[박운성] week5 #217
Conversation
} else { | ||
if(emailInput.parentElement.querySelector('.error')) { | ||
emailInput.classList.remove('error'); | ||
emailInput.parentElement.lastElementChild.remove(); |
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.
parentElement
, lastElementChild
이런 종류의 property는 html 구조에 의존하게 됩니다. 즉, 추가적인 요구사항에 따라 구조가 바뀌게 되는 경우 해당 코드를 다시 수정해야하는 번거로움이 생기죠.
해당 태그를 한번에 찾아갈 수 있게 적절히 class
, id
를 부여해서 직접 접근하는 방법으로 사용해주세요.
} | ||
} | ||
|
||
const eyeEvent = function (eyes) { |
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.
함수명은 setEyeEvent
가 자연스럽네요.
}; | ||
|
||
if (isTestUser) { | ||
fetch('https://bootcamp-api.codeit.kr/api/sign-in', { |
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.
then / catch
callback 형식으로 처리한다고하면 마지막 then()
끝에 catch()
까지 체이닝해주셔야 예외처리가 가능합니다.
차라리 async/await
패턴으로 바꾸셔서 try/catch
로 적용해보시는 것이 요즘 트렌드긴 합니다.
const eyeClass = e.target.parentElement.classList; | ||
const pwdText = e.target.parentElement.parentElement.firstElementChild; | ||
console.log('o'); |
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.
너무 parentElement랑 elementChild 종류를 많이 쓰는 것 같습니다.
console.log('o'); 코드가 꼭 필요한 게 아니면 지우는 게 좋을 것 같습니다
요구사항
기본
심화
주요 변경사항
멘토에게