ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [100DaysOfCode] 31๊ฐ•
    Front-end/100DaysOfCode 2022. 8. 26. 23:56

     

    ๐Ÿ’ก ํ•จ์ˆ˜

     

    ํ•จ์ˆ˜์˜ ์žฅ์ : ์ฝ”๋“œ์˜ ์žฌ์‚ฌ์šฉ

     

    ๋ฏธ๊ตญ ๋‚˜์ด ๊ธฐ์ค€์œผ๋กœ ์„ฑ์ธ์ด ๋œ์ง€ ์–ผ๋งˆ๋‚˜ ๋๋Š”์ง€ ๊ณ„์‚ฐํ•˜๊ณ  ์‹ถ์„ ๋•Œ

    let adultYears = age - 18; // ๋ฏธ๊ตญ ์„ฑ์ธ ๋‚˜์ด ๊ณ„์‚ฐ
    
    let manAge = age - 18;
    let womanAge = age - 18;

     

    ๋งŒ์•ฝ ํ•œ๊ตญ ๋‚˜์ด๋กœ ๋ฐ”๊พธ๊ณ  ์‹ถ๋‹ค๋ฉด? ์ผ์ผ์ด 'age - 18' ์ฝ”๋“œ๋ฅผ ๋ณ€๊ฒฝํ•ด์ฃผ์–ด์•ผ ํ•œ๋‹ค๐Ÿ˜จ

     

    ํ•จ์ˆ˜ ์‚ฌ์šฉ

    let age = 0
    
    function calculateAge(age) {
       return age - 18;
    }
    
    let manAge = calculateAge(20);
    let womanAge = calculateAge(21);
    
    console.log(manAge);
    console.log(womanAge);

    ์ฝ˜์†”์ฐฝ์—์„œ ์—ฐ์‚ฐ๊ฒฐ๊ณผ ํ™•์ธ

     

    ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•จ์œผ๋กœ์จ ํ•œ๊ตญ ๋‚˜์ด๋กœ ๋ฐ”๊พธ๊ณ  ์‹ถ์„ ๊ฒฝ์šฐ ํ•จ์ˆ˜ ๋‚ด์— ์žˆ๋Š” ์ˆซ์ž๋งŒ ๋ณ€๊ฒฝํ•ด์ฃผ๋ฉด ๋œ๋‹ค!

     

     

     

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

    [100DaysOfCode] 33๊ฐ•  (0) 2022.09.04
    [100DaysOfCode] 32๊ฐ•  (0) 2022.09.01
    [100DaysOfCode] 30๊ฐ•  (0) 2022.08.23
    [100DaysOfCode] 27๊ฐ• - 28๊ฐ•  (0) 2022.08.21
    [100DaysOfCode] 26๊ฐ•  (0) 2022.08.18
Designed by Tistory.