Notice
Recent Posts
Recent Comments
Link
«   2025/02   »
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
Archives
Today
Total
관리 메뉴

UI/UX 공부기록

[본캠프 11주차] 화요일 TIL 본문

본캠프

[본캠프 11주차] 화요일 TIL

hyunjiii 2024. 12. 31. 19:00

 




12/31 일일 목표📝


 

리액트 입문 강의 듣기

디자인 집중반

 


 

 

📖 오늘 배운 내용

map 

const numbers = [1, 2, 3, 4, 5];

const squared = numbers.map(주어진 함수);

 

화살표 함수

const add = (a, b) => {
   return a + b;
}
위의것을 줄이면
const add = (a, b) => a + b;

console.log(add(1, 3));

 

조건 연산자(삼항연산자)

조건에 따라서 형태를 간단하게 하는

const score = 85;
let grade = "";

if (score >= 80) {
   grade = "A"
}  else {
   grade = "B";
}
const score = 85;
const grade = score >= 80 ? "A" : "B";

console.log(grade);  

 

 

단축평가

- 논리 연산자를 활용 ( ||, &&, ?., ??)

 

논리합연산자 ||

truethy falsy 한 값이 중요함

falsy인 값은? false, 0 , "" , null, undefinde , NaN

const getUserName = (user) => user.name || "신원미상";

const person = {
   age : 30,
   name : "르탄이",
};
console.log(getUserName(person));

 

 

논리곱 연산자 (&&)

const loggedIn = true;
const userName = "르탄이";

loggedIn && console.log('환영합니다 ${userName}님!');

 

const user = {

   profile : {

      name: "르탄이",

      details: {

         age : 30,

         location: "서울시 강남구",

      },

    },

};

 

console.log(user.profile.details.age);

 

 

null 병합 연산자 (??)

let userLocation = null;

console.log(userLocation ? userlocatin : "없는위치");

 

'본캠프' 카테고리의 다른 글

[본캠프 12주차] 월요일 TIL  (0) 2025.01.06
[본캠프 11주차] 목요일 TIL  (1) 2025.01.02
[본캠프 11주차] 월요일 TIL  (0) 2024.12.30
[본캠프 10주차] 금요일 WIL  (2) 2024.12.27
[본캠프 10주차] 목요일 TIL  (0) 2024.12.26