ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [100DaysOfCode] 32๊ฐ•
    Front-end/100DaysOfCode 2022. 9. 1. 09:28

     

     

    ๐Ÿ’ก ๋ฉ”์„œ๋“œ์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์ž

     

    ๐Ÿ“Œ ๊ฐ์ฒด object(lable: value)
    ๊ฐ์ฒด๋ž€ 0๊ฐœ ์ด์ƒ์˜ ํ”„๋กœํผํ‹ฐ๋กœ ๊ตฌ์„ฑ๋œ ์ง‘ํ•ฉ์ด๋ฉฐ, ํ”„๋กœํผํ‹ฐ๋Š” ํ‚ค์™€ ๊ฐ’์œผ๋กœ ๊ตฌ์„ฑ๋œ๋‹ค

     


    ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋Š” ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•ด ํด๋ž˜์Šค๋ฅผ ๋จผ์ € ์ •์˜ํ•˜๊ณ  ์ƒ์„ฑ์ž๋ฅผ ํ˜ธ์ถœํ•  ํ•„์š” ์—†์ด ๋ฆฌํ„ฐ๋Ÿด๋กœ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค!
    let job = {
      title: "developer",
      location: "Seoul",
    };

     

    ๐Ÿ“Œ ๊ฐ์ฒด์— ๋ฉ”์„œ๋“œ ์ถ”๊ฐ€
    ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ ํ•จ์ˆ˜๋Š” ์ผ๊ธ‰ ๊ฐ์ฒด๋ผ์„œ ํ•จ์ˆ˜๋ฅผ ๊ฐ’์œผ๋กœ ์ทจ๊ธ‰ํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ํ”„๋กœํผํ‹ฐ ๊ฐ’์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค

     

    let person = {
      name: "Yeonsu", // ํ”„๋กœํผํ‹ฐ
    
      // ๋ฉ”์„œ๋“œ(๋งค๊ฐœ๋ณ€์ˆ˜, return๊ฐ’X)
      // ํ”„๋กœํผํ‹ฐ ๊ฐ’์ด ํ•จ์ˆ˜์ผ ๊ฒฝ์šฐ ์ผ๋ฐ˜ ํ•จ์ˆ˜์™€ ๊ตฌ๋ถ„ํ•˜๊ธฐ ์œ„ํ•ด ๋ฉ”์„œ๋“œ๋ผ ๋ถ€๋ฅธ๋‹ค
      greet() {
        console.log("Hello!");
      },
    };
    
    //๊ฐ์ฒด์˜ ๋ฉ”์„œ๋“œ์— ์ ‘๊ทผ
    person.greet();

     


    ๐Ÿ’ก ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ ๋‹ค์–‘ํ•œ ์—ฐ์‚ฐ์‹

     

    // Math operations
    
    console.log(10 + 4); // 14 (integer)
    console.log(10 - 4); // 6 (integer)
    console.log(10 * 4); // 40 (integer)
    console.log(10 / 4); // 2.5 (float)
    console.log(10 % 4); // ๋ชจ๋“ˆ๋Ÿฌ์Šค(modulus) ์—ฐ์‚ฐ์ž -> ๋‚˜๋จธ์ง€ ๊ฒŒ์‚ฐ
    
    // ์ถ•์•ฝ ๊ณ„์‚ฐ์‹
    let result = 10 * 4; //40
    result++;
    result--;
    
    result += 5;
    result -= 5;
    
    console.log(result);
    
    console.log("My name is " + "yeonsu");
    // console.log("My name is" - "is"); ๋ฌธ์ž์—ด์„ ๋นผ๋Š” ๊ฒƒ์€ ๋ถˆ๊ฐ€๋Šฅ
    
    let userName = "yeonsu";
    console.log(userName.length); // ๋ฌธ์ž์—ด ๊ธธ์ด ์•Œ๋ ค์ฃผ๋Š” ์†์„ฑ
    console.log(userName.toUpperCase()); // ๋Œ€๋ฌธ์ž๋กœ ๋ฐ”๊ฟ”์ฃผ๋Š” ์†์„ฑ

     

     

    'Front-end > 100DaysOfCode' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

    [100DaysOfCode] 34๊ฐ•  (0) 2022.09.12
    [100DaysOfCode] 33๊ฐ•  (0) 2022.09.04
    [100DaysOfCode] 31๊ฐ•  (0) 2022.08.26
    [100DaysOfCode] 30๊ฐ•  (0) 2022.08.23
    [100DaysOfCode] 27๊ฐ• - 28๊ฐ•  (0) 2022.08.21
Designed by Tistory.