TIL no.34

손병진·2020년 9월 15일
0

wecode

목록 보기
19/27

Codekata💢

replace / subString / splice

  • 문자열을 잘라주는 메소드
// 복소수 계산 문제
const complexNumberMultiply = (a, b) => {
  a = a.replace("i", "");
  b = b.replace("i", "");
  let array1 = a.split("+");
  let array2 = b.split("+");
  let front_value = String(
    Number(array1[0]) * Number(array2[0]) +
      Number(array1[1]) * Number(array2[1]) * -1
  );

  let back_value = String(
    Number(array1[0]) * Number(array2[1]) +
      Number(array1[1]) * Number(array2[0])
  );
  return `${front_value}+${back_value}i`;
};

life cycle

  • setState 메소드로 변경된 값은
    render 실행되었을 때 적용되어진다.
  • 조건부 렌더링
    • 삼항연산자
    this.state.property? this.function: null
    • &&
    this.state.property && this.function

오늘의 CSS🎨

grid & flex

.ProductListMain {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 10px;
    grid-auto-rows: minmax(100px, auto);


    // display: flex;
    // flex-wrap: wrap;
    // width: 800px;
}
profile
https://castie.tistory.com

0개의 댓글