• A tool that you can find specific word in String
  • comfile
    1
    2
    var pattern = /p/
    var pattern = new RegExp('p');
    c
  • exec
    1
    2
    console.log(pattern.exec('paige')); // ["p"]
    console.log(pattern.exec('aige')); // null
    cs
  • test
    • returns as Boolean
      1
      2
      console.log(pattern.test('paige')); // true
      console.log(pattern.test('aige')); // false
      cs
  • STRING METHOD
    • match
      1
      2
      console.log('paige'.match(pattern)); // ["p"]
      console.log('aige'.match(pattern)); // null
      cs
    • replace
      1
      console.log('paige'.replace(pattern, 'P'));  // Paige
      cs
  • OPTION
    • i : does not care whether uppercase or lowercase
      1
      2
      3
      4
      var xi = /p/;
      console.log("Paige".match(xi)); // null
      var oi = /p/i;
      console.log("Paige".match(oi)); // ["P"];
      cs
    • g: returns all the result
      1
      2
      3
      4
      var xg = /p/;
      console.log("Paige".match(xg)); // null
      var og = /p/g;
      console.log("Paige".match(og)); // ["P"];
      cs
    • ig : can find all result whether uppercase or lowercase
      1
      2
      var ig = /p/ig;
      "Paigepaige".match(ig); // ["P", "p"]
      cs
  • CAPTURE
    • \w : you are getting words from A~Z, a~z, 0~9
    • + : more than one value 
    • \s : represents space
      1
      2
      3
      var pattern = /(\w+)\s(\w+)/;
      var str = "Paige Kim";
      var result = str.replace(pattern, "$2, $1"); // "Kim, Paige"
      cs
  • REPLACE
    1
    2
    3
    4
    5
    6
    var urlPattern = /\b(?:https?):\/\/[a-z0-9-+&@#\/%?=~_|!:,.;]*/gim;
    var content = 'github : https://github.com/paigekim29 입니다. 
    tistory : https://paigekim29.tistory.com/ 입니다. '
    ;
    var result = content.replace(urlPattern, function(url){
        return '<a href="'+url+'">'+url+'</a>';
    });
    console.log(result); // github : <a href="https://github.com/paigekim29">
    https://github.com/paigekim29</a> 입니다.
    tistory : <a href="https://paigekim29.tistory.com/">
    https://paigekim29.tistory.com/</a> 입니다.
      cs

 

 

reference: https://opentutorials.org/course/743/6580

'Today's Finding' 카테고리의 다른 글

Lexical Scope  (0) 2020.11.04
HOISTING  (0) 2020.11.04
How to calculate number easily in Javascript  (0) 2020.10.28
Shortcut in Mac  (0) 2020.10.27
isNaN(is Not a Number)  (0) 2020.10.27
1
2
3
minute = minute +1;
minute += 1;
minute ++;
cs

reference: https://www.w3schools.com/js/js_arithmetic.asp

'Today's Finding' 카테고리의 다른 글

HOISTING  (0) 2020.11.04
Regular Expressions(정규표현식)  (0) 2020.10.28
Shortcut in Mac  (0) 2020.10.27
isNaN(is Not a Number)  (0) 2020.10.27
How to use Color Scripter in Tistory  (0) 2020.10.26

WHAT I LEARNED

 

After submitting the pair review, I realized the fact that my pair and I did not choose who will be the driver or navigator. Even  though we did not assign tasks to each other, we communicated well for our pair programming. For this moment, I think it is quite unnecessary to decide who will be the driver or navigator since we are both novices. If one of us has more knowledge on the subject and can lead the coding, we could decide who can be a driver. Once we get to be more familiar with javascript or what we are doing, by then it would be better to decide. Today is the last day with my first pair and I will meet another one tomorrow and learn html and css. But the problem is I am still struggling with iteration at the moment..... I hope I get to finish iteration problem solving before bedtime. I still have 8 questions left until I go to sleep. I will probably sleep late or wake up early tmrw to finish this🤯 Iteration lecture seems super simple, but the reality is very different. Past topics can be done in the timeline, but this one takes up more time than what I originally thought. Also, I asked some questions through help desk today, so I probably need to review those tmrw...


  1. ITERATION (반복문): when you want to repeat actions continuosly until I want from 0 to n
    • for statement
      • useful when you know the end at array and string
        1
        2
        3
        4
        5
        6
        7
        8
        9
        10
        for (initialExpression(초기화); conditionExpression(조건식); incrementExpression(증감문)) {
            statement
        }
         
        let sum = 7;
         
        for(let n = 0; n <= 2; n = n + 1) {
        sum = sum + n;
        }
        console.log(sum); // 10
        cs
    • while statement
      • useful when you do not need either initialExpression and increment Expression
      • when you dont know for the end
        1
        2
        3
        4
        5
        6
        7
        8
        9
        10
        11
        12
        13
        14
        initialExpression(초기화)
        while(conditionExpression(조건식)) {
            statement
            incrementExpression(증감문)
        }
         
        let sum = 7;
        let n = 0;
         
        while(n <= 2) {
        sum = sum + n;
        = n + 1;
        }
        console.log(sum); // 10
        csS
  2. String Methods
    • In order to return value as String using BACKTICK(``)
      • use $ sign and {} to get arguments and use `` sign around the value you want to print as String
        1
        2
        3
        function showTime(hour, min, sec) {
          return `현재 시각은 ${hour}시 ${min}분 ${sec}초 입니다.`
        }
        cs

'TIL' 카테고리의 다른 글

TIL 2020.10.30  (0) 2020.10.30
TIL 2020.10.29  (0) 2020.10.29
TIL 2020.10.27  (0) 2020.10.27
TIL 2020.10.26  (0) 2020.10.26
TIL 2020.10.24  (0) 2020.10.24
  • refresh : command + r
  • command + d : to select same items continuously
  • command + control + space : emoji 😜

VSC

  • option + click : to click line you want
  • option + ↑/↓ : move items up and down
  • option + shift + ↑/↓: to copy up and down
  • command + / : to remark
  • option + shift + i : can put cursor with all selection
  • option + shift+ drag : can put cursor where your mouse is at so it is helpful when you want to select lines with different lengths of codes
  • command + ↑/↓ : to go to top and bottom
  • command + b: to remove sidebar

'Today's Finding' 카테고리의 다른 글

HOISTING  (0) 2020.11.04
Regular Expressions(정규표현식)  (0) 2020.10.28
How to calculate number easily in Javascript  (0) 2020.10.28
isNaN(is Not a Number)  (0) 2020.10.27
How to use Color Scripter in Tistory  (0) 2020.10.26
  1. -infinity / - infinity = NaN
  2. 0 / 0 =NaN

'Today's Finding' 카테고리의 다른 글

HOISTING  (0) 2020.11.04
Regular Expressions(정규표현식)  (0) 2020.10.28
How to calculate number easily in Javascript  (0) 2020.10.28
Shortcut in Mac  (0) 2020.10.27
How to use Color Scripter in Tistory  (0) 2020.10.26

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

티스토리 업데이트 이후, 소스 코드 이용 방법

 

reference: https://gabii.tistory.com/entry/Tistory-Blog-%EB%B0%94%EB%80%90-Color-Scripter-%EB%B3%B5%EC%82%AC-%EB%B0%A9%EB%B2%95-%EC%82%AC%EC%9A%A9

'Today's Finding' 카테고리의 다른 글

HOISTING  (0) 2020.11.04
Regular Expressions(정규표현식)  (0) 2020.10.28
How to calculate number easily in Javascript  (0) 2020.10.28
Shortcut in Mac  (0) 2020.10.27
isNaN(is Not a Number)  (0) 2020.10.27

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

TO DO LIST

  1. Review Python

WHAT I LEARNED

  • Difference between 'parameters' and 'arguments' in python
    • Parameters: variable you put inside parentheses in defintion
    • Arguments: value that will be sent when the definition is called
  • recursive=False: if you want to call direct son while using find_all()
  • reverse=true: if you want to reverse items inside list
  • lamda: to create anonymous function

 

reference: https://blog.naver.com/rkttndk/221836743731

 

파이썬 함수 : Python Functions:재귀 함수:parameter/arguments 전달

함수는 호출 되었을 때만 실행되는 코드 블락이다.매개 변수를 이용하여 함수에게 데이터를 넘겨줄 수 있으...

blog.naver.com

stackoverflow.com/questions/8966538/syntax-behind-sortedkey-lambda

 

Syntax behind sorted(key=lambda: ...)

I don't quite understand the syntax behind the sorted() argument: key=lambda variable: variable[0] Isn't lambda arbitrary? Why is variable stated twice in what looks like a dict?

stackoverflow.com

 

'TIL' 카테고리의 다른 글

TIL 2020.10.27  (0) 2020.10.27
TIL 2020.10.26  (0) 2020.10.26
TIL 2020.10.22  (0) 2020.10.22
TIL 2020.10.21  (0) 2020.10.22
TIL 2020.10.20  (0) 2020.10.20

TO DO LIST

  1. Nomad coders' python challenge: Use python and do web scrapping of reddit.com ❌ -> one more day left to submit challenge.....
    • Need to figure out how to connect input with python.

WHAT I LEANRED

  • Got more familiarized python by doing challenge

TODAY'S DIARY

 

Got my result back from code states and I will start 20 weeks program starting from October 26th, 2020 🤞

 

'TIL' 카테고리의 다른 글

TIL 2020.10.26  (0) 2020.10.26
TIL 2020.10.24  (0) 2020.10.24
TIL 2020.10.21  (0) 2020.10.22
TIL 2020.10.20  (0) 2020.10.20
TIL 2020.10.19  (0) 2020.10.19

+ Recent posts