let num = 9;
console.log(num * 1) // 9
console.log(num * 2) // 18
console.log(num * 3) // 27
console.log(num * 4) // 36
console.log(num * 5) // 45
console.log(num * 6) // 54
console.log(num * 7) // 63
console.log(num * 8) // 72
console.log(num * 9) // 81
function mulTablePrinter(num) {
console.log(num * 1);
console.log(num * 2);
console.log(num * 3);
console.log(num * 4);
console.log(num * 5);
console.log(num * 6);
console.log(num * 7);
console.log(num * 8);
console.log(num * 9);
}
mulTablePrinter๋ผ๋ ์ด๋ฆ์ ํจ์๊ฐ ์ ์ธ์ด ๋๋ค.
mulTablePrinter ํจ์๋ num์ด๋ผ๋ ๋ณ์๋ฅผ ๋งค๊ฐ๋ณ์๋ก ๋ฐ์์, num์ 1์์ 9๊น์ง์ ์ซ์๋ฅผ ๊ณฑํ ๊ฐ์ ๊ฐ๊ฐ ์ถ๋ ฅ
์ฌ๊ฐํ์ ๋์ด
let getRectangleArea = function (width, height) {
let rectangleArea = width * height
return rectangleArea
}
๋ณ์ ์ ์ธ - ํ ๋น -
function getRectangleArea (width, height) {
let rectangleArea = width * height;
return rectangleArea
}
rectangleArea์ด๋ผ๋ ๋ณ์์ ๋ฐ๋ณ์ ๊ธธ์ด์ ๋์ด์ ๊ณฑ์ ํ ๋นํ ํ rectangleArea๋ฅผ ๋ฆฌํด
function getRectangleArea (width, height) {
return width * height
}
ํจ์ ๋ด๋ถ์์ ๋ณ์๋ฅผ ํ ๋นํ์ง ์์์ง๋ง ๊ธธ์ด์ ๋์ด์ ๊ณฑ์ ๋ฐ๋ก ๋ฆฌํด
-ํจ์์ ๊ฒฐ๊ณผ๋ฌธ์ ๋์ถํ๊ธฐ ์ํด์๋ return๋ฌธ์ด ๊ผญ ๊ผญ ํ์
ํ์ดํ๋ก ์์ฑํ๋ฉด ๋ฆฌํด์ด๋ ์ค๊ดํธ ์๋ต ๊ฐ๋ฅ
'์ฝ๋ฉ ๋ฉ๋ชจ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
- ์ฌ๋ฌ ๋งํฌ (0) | 2022.08.25 |
---|---|
- HTML / CSS ๋ฉ๋ชจ (0) | 2022.08.25 |
- ๋ฌธ์์ด (0) | 2022.08.24 |
- let , const ์ ์ฐจ์ด (0) | 2022.08.22 |
- typeof ์ฐ์ฐ์๋ฅผ ์ฌ์ฉํ์ฌ ๊ฐ์ ํ์ ์ ํ์ธํ๋ ๋ฐฉ๋ฒ (0) | 2022.08.22 |