WHAT I LEARNED

 

While my partner and I solve problems together, sometimes I realize that we both need to think simply because we tend to overthink. Fortunately, we get along and I am thankful for my buddy who always answers the questions I ask and help me review what I have learned. I think we can finish what we have to do according to the timeline.


  1. CONDITIONAL(조건문)
    • Always need 'Comparison Operator'(비교 연산자)
      • > more than
      • < less than
      • >= ane more
      • <= and less
      • === equal
      • !== not equal
    • Result is always 'boolean'(true/false) 
      1
      2
      3
      4
      if(condition 1) {
      else if (condition 2) {
      else {
      }
      c
      • else can be omitted depends on  function.
    • To apply 2 conditions together, use 'Logical Operator'(논리 연산자)
  2. STRING METHODS = IMMUTABLE
    • If you do string type + any different type, it becomes string type automatically.
      1
      2
      let str='Paige';
      console.log(str +29); // 'Paige29'
      cs
    • If you want to get length,
      1
      2
      let str='Paige';
      console.log(str.length); // 5
      cs
    • If you want to find value,
      1
      2
      3
      'Paige'.indexOf('Paige'); // 0
      'Paige'.indexOf('paige'); // -1
      'Paigee'.lastindexOf('a'); // 5
      cs
      • if there is no value, it returns -1
      • lastindexof is you find index from the back and check the order from the front.
      • str.includes(searchValue) does not work at outdated browser and returns as Boolean
    • If you want to seperate,
      1
      str.split(' ')
      cs
      • Good for CSV
    • If you want to get certain values from the string,
      1
      2
      3
      str = 'paige';
      str.substring(02); // 'pa'
      str.slice(02); // 'pa'
      cs
    • If you want to Uppercase/Lowercase,
      • str.toLowerCase();
      • str.toUpperCase();
    • Math
      • Math.floor(x) = 내림;
      • Math.ceil(x) = 올림;
      • Math.round(x) = 반올림;
      • Math.pow(base, exponent) = 제곱
        1
        Math.pow(52= 25;
        cs
      • var1 ** var2 = 제곱
        1
        2 ** 3   // 8
        cs
    • ADDITIONAL
      • trim() : remove space inside string
      • \n : new line

  • Need to google more about regular expressions

 

 

'TIL' 카테고리의 다른 글

TIL 2020.10.29  (0) 2020.10.29
TIL 2020.10.28  (0) 2020.10.28
TIL 2020.10.26  (0) 2020.10.26
TIL 2020.10.24  (0) 2020.10.24
TIL 2020.10.22  (0) 2020.10.22

+ Recent posts