일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- String
- Hash
- 그래프
- 이진탐색
- 다익스트라
- Brute Force
- Two Points
- union find
- DP
- two pointer
- 스토어드 프로시저
- binary search
- SQL
- Trie
- MYSQL
- Dijkstra
- Stored Procedure
Archives
- Today
- Total
codingfarm
함수 정의 방법 4가지 본문
1. function 키워드를 이용하는 방법
1
2
3
4
5
|
function hello(name){
document.write(name+"님 환영합니다.");
return 5;
}
var integer = hello("honggildong");
|
cs |
2. 함수 리터럴을 이용하는 방법
1
2
3
4
|
var hello = function(name){
document.write(name+"님 환영합니다.");
}
hello("ddandongne");
|
cs |
3. Function 객체를 이용해서 정의하는 방법
1
2
|
var hello = new Function("name", "document.write(name + '님 환영합니다.')");
hello("ddandongne");
|
cs |
4. 익명 함수 확장을 이용해 정의하는 방법
1 2 3 | (function(name){ document.write(name+"님 환영합니다."); })("ddandongne"); | cs |
'web > JavaScript' 카테고리의 다른 글
중첩 함수(Nested Function) (2) | 2020.10.11 |
---|---|
함수 종류 (0) | 2020.10.11 |
함수 리터럴(function literal)과 익명 함수(anonymous function) (0) | 2020.10.11 |
경품추천기 (0) | 2020.10.09 |
소개 (0) | 2020.10.09 |
Comments