Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- Til
- ์ฝ๋ฉ์ ํ
- ์ฝ๋ฉ
- ํ๋ก์ ํธ
- javascript
- fe
- ๊ฐ๋ฐ
- ๋ชจ๊ฐ์ฝ
- ๊ทธ๋ฆฌ๋
- CSS
- HTML
- JS
- ํฌ๋กค๋ง
- KDT
- ์๊ณ ๋ฆฌ์ฆ
- ๊ตญ๋น์ง์
- ์ฝ๋ฉํ ์คํธ
- node.js
- ํ๋ก ํธ์๋
- ํ ์ดํ๋ก์ ํธ
- ๋ฐฑ์ค
- react
- ํ์ด์ฌ
- heapq
- ๋ ธ๋ง๋์ฝ๋
- ๋๋ฆผ์ฝ๋ฉ
- error
- mongodb
- Python
- ํ๋ก๊ทธ๋๋จธ์ค
Archives
- Today
- Total
๐ฑ → ๐ณ
[JavaScript] ๋ ธ๋ง๋์ฝ๋ ๋ฐ๋๋ผJS ์ฑ๋ฆฐ์ง 3์ผ์ฐจ ๋ณธ๋ฌธ
728x90
๋ฐ๋๋ผJS๋ก ํฌ๋กฌ์ฑ ๋ง๋ค๊ธฐ: From #2.7 to #2.16
#2.7 Functions
argument : function์ ์คํํ๋ ๋์ ์ด๋ค ์ ๋ณด๋ฅผ function์๊ฒ ๋ณด๋ผ ์ ์๋ ๋ฐฉ๋ฒ
#2.8 Functions part Two
NaN : Not a Number
ํจ์๋ฅผ ๋ถ๋ฅด๊ณ , ์ ๋ ฅํ๋ ๊ฒ ๊น์ง ๋ฐฐ์
//object ์์ function์ด ์๋ ๊ฒฝ์ฐ
const player = {
sayHello: function(otherName){
console.log("Hello " + otherName);
}
}
player.sayHello("nico");
player.sayHello("lynn");
#2.11 Returns
#2.13 Conditionals
prompt
: ์ฌ์ฉ์์๊ฒ ๋ฉ์์ง๋ฅผ ๋ณด์ฌ์ฃผ๊ณ ๊ฐ์ ์ ๋ ฅ ๋ฐ์
์๋ฐ์คํฌ๋ฆฝํธ ์ฝ๋์ ์คํ์ ๋ฉ์ถ๊ฒ ํจ(์ ๋ ฅ ๋ฐ์ ๋๊น์ง)
CSS๋ก ๊พธ๋ฐ ์ ์์ด์ ์ง๊ธ์ ์ ์ฌ์ฉํ์ง ์์
typeof : vaiable์ type์ ํ์ธ
parseInt : string์ number๋ก ๋ณํํด์ฃผ๋ ํจ์
#2.14 Conditionals part Two
//age ๋ฐ์์ int๋ก type ๋ณ๊ฒฝ
const age = parseInt(prompt("How old are you?"));
//age๊ฐ Number์๋๋ฉด Please write Number ๋ฌธ๊ตฌ ์ถ๋ ฅ
if(isNaN(age)) {
console.log("Please write Number");
} else {
console.log("Thank you for writing your age");
}
#2.15 Conditionals part Three
// else if ์ฌ์ฉ
const age = parseInt(prompt("How old are you?"));
if(isNaN(age) || age < 0 ) {
console.log("Please write a real positive Number");
} else if (age < 18){
console.log("You are too young");
} else if (age >= 18 && age <= 50) {
console.log("You can drink");
} else {
console.log("umm,, ");
}
728x90
'Client > Javascript' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[JavaScript] JS ๊ธฐ์ด ๋ง๋ฌด๋ฆฌ (0) | 2022.07.15 |
---|---|
[JavaScript] JS ๊ธฐ์ด (0) | 2022.07.13 |
[JavaScript] ๋ ธ๋ง๋์ฝ๋ - ๋ฐ๋๋ผJS 2์ผ์ฐจ (0) | 2022.04.12 |
[JavaScript] ๋ ธ๋ง๋์ฝ๋ - ๋ฐ๋๋ผJS ์ฑ๋ฆฐ์ง 1์ผ์ฐจ (0) | 2022.04.11 |
์ํ์ฝ๋ฉ WEB2 - JavaScript ํ๊ณ (0) | 2022.04.08 |