GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JavaScript_docs/04.function/7.functionQuize.js at main · dev-language/JavaScript_docs

Expand file tree

/

7.functionQuize.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
40 lines (31 loc) · 1015 Bytes
/

7.functionQuize.js

Copy path

File metadata and controls

40 lines (31 loc) · 1015 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
32
33
34
35
36
37
38
39
40
function iterate(max, action) {
for (let i = 0; i <= max; i++) {
action(i);
}
}
function printLog(num) {
console.log(`printLog: ${num}`);
}
function multiplyAndLog(num) {
let result = num * 2;
console.log(`multiplyAndLog: ${result}`);
}
function divideAndLog(num) {
console.log(`divideAndLog: ${num / 2}`);
}
const print = (num) => console.log(`print: ${num}`);
const divideAndPrint = (num) => console.log(`divideAndPrint: ${num / 2}`);
iterate(3, print);
iterate(5, divideAndPrint);
iterate(3, multiplyAndLog); // 0, 2, 4, 6
iterate(5, divideAndLog); //0, 0.5, 1, 1.5, 2, 2.5
//화살표 함수를 사용해서 값을 전달하는것도 가능하다.
iterate(3, (num) => console.log(num * 2)); //0, 2, 4, 6
iterate(5, (num) => console.log(num / 2)); //0, 0.5, 1, 1.5, 2, 2.5
// 실제로 사용하는 예시
setTimeout(() => {
}, timeout);
// 로더라는 클래스를 3.2초 뒤에 사라지게 해줘
// setTimeout(() => {
// $('.loader').fadeOut(200);
// }, 3200);
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.