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

WHAT I LEARNED

 

Today was the first day of 'Code States' 20 weeks program and realized that what I learned from Nomad Coders was somewhat helpful, but still need to practice and review more on Javascript... Before I was not familiar with 'return' fully, and made me to have a hard time to use it again. Until now, I always learned and studied by myself. If there was a question, I used to ask through slack or google. However, it was always a challenging moment for me to be fully understood. Today, I got to pair up with a buddy and cooperated each other to solve problems regards to what I have learned today. It helps me out more than before because I could communicate with my buddy and got to solve questions together. I already see a good influence of having a pair and I look forward to work with others more through out this program!


  1. DECLARATION(변수 선언하기)
    • variable(변수)= value that can be changed
        • use 'let'
          1
          let number;
          cs
        • after declaration, you can 'ASSIGN'
          1
          let number = 7
           
  2. FUNCTION(함수)
    • Function Declaration(함수 선언식)
      1
      2
      3
      4
      function calculate(number) {
          number = number + 7;
          return number;
      }
      c
       
    • Function Expression(함수 표현식)
      1
      2
      3
      4
      let calculate = function (number) {
          number = number + 7;    
          return number;
      }
      c
  3. PARAMETER(매개변수)
    • A variable that you will be used as an input at function
      1
      2
      3
      4
      function calculate(width){
          areaOfSquare = width * width;
          console.log(areaOfSquare); // undefined
      }
      cs
  4. ARGUMENT(전달인자)
    • Output value that will be applied inside function
      1
      calculate(5// 25
       
  5. RETURN
    • Without return value inside function, the function will be undefined when console log it.
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      function calculate(width){
          areaOfSquare = width * width;    
      }
      calculate(5// 25
      console.log(areaOfSquare); // undefined
       
      function calculate(width){
          areaOfSquare = width * width;
          return areaOfSquare;
      }
      console.log(areaOfSquare); //25    
      cs
  6. TYPE
    • String
      1
      String(Hi!); // 'Hi!'
      cs
    • Number
      1
      Number('123'); // 123
      cs
    • Boolean
      1
      true / false
      cs
    • Undefined
      • when value was not assigned
    • Function

  7. ARRAY (배열)
    1
    let paige = ['paige''women''24'];
    cs
  8. OBJECT (객체)
    1
    2
    3
    4
    let paige = {name'paige',
    gender: 'women'
    age: '24'
    };
    cs

'TIL' 카테고리의 다른 글

TIL 2020.10.28  (0) 2020.10.28
TIL 2020.10.27  (0) 2020.10.27
TIL 2020.10.24  (0) 2020.10.24
TIL 2020.10.22  (0) 2020.10.22
TIL 2020.10.21  (0) 2020.10.22

+ Recent posts