
목차 아.. 오늘 Redux react 쓸려했는데... 일이 생겨 피곤해서 쉬는 포스팅! Switch case 변수 지정 이게 무슨 말이냐면 정석적으로, switch를 쓸 때 이렇게 쓰는데 let text = "apple"; switch(text){ case "apple": console.log("apple"); break; case "banana": console.log("banana"); break; case "cocoa": console.log("cocoa"); break; default: break; } 이렇게 하면 text에 값을 입력할 때, case에 값을 입력할 때 오타가 나서 디버깅에 오랜 시간을 허비할 수 있다. const apple = "apple"; const banana = "ban..

여러 가지 버튼을 만들고 각각의 버튼에 따라 다른 효과를 내기 위해, switch가 필요하게 되었다. 그런데 뭔가 switch보다 더 이쁘게 쓰고 싶어 찾아보다가 enum을 알게 되어 포스팅하게 되었다. Switch 일단 enum과 비교할 겸 switch를 한번 짚고 넘어가자! switch는 지정 변숫값에 따라 여러 결과를 나타낼 수 있는 분기문(상황에 따라 달라지는 문장)이다. 일단 html은 기본값으로 넣고 Js 불러오기 외에는 기본값이다. let choice = 1; switch(choice){ case 0 : document.body.style.background = 'tomato'; break; case 1 : document.body.style.background = 'skyblue'; bre..
- Total
- Today
- Yesterday
- useReducer
- switch
- usecookies
- 아이콘
- CSS
- 랜더링
- 무료아이콘
- 서버
- SVG
- dom
- html
- proptype
- 가상샐렉터
- 접근성
- 이쁜코드
- touchable
- 에러
- visualcode
- Expo
- Router
- 클릭
- nodejs
- 비동기
- async
- 웹접근성
- Redux
- react
- homebrew
- 쿠키
- Hook
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |