본문 바로가기
공부/Front-End

[JavaScript #02] Functions

by 혼밥맨 2020. 12. 13.
반응형

[JavaScript #02] Functions

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
// Greeting function
function greeting(name, time) {
    console.log('Good ' + time + ', ' + name + '!');
}

// Calculating cube function
function cube{number) {
    return number * number * number;
}

//executing greeting function
greeting('John', 'Morning'); //prints out "Good Morning, John!"

//executing cube function
console.log(cube(2)); // prints out 8

Herer are two simple functions! : JavaScript Greeting function and JavaScript cube function.

 

반응형

댓글