Skip to content

Commit

Permalink
section 6 : functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeeppy committed Apr 15, 2023
1 parent ecb5d62 commit 03cf587
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
12 changes: 12 additions & 0 deletions session6/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Les fonctions</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
53 changes: 53 additions & 0 deletions session6/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
function sayHello(first_name) {
alert("Bonjour " + first_name)
}

function addition(nombreUn, nombreDeux) {
console.log(nombreUn + nombreDeux)
}

let cry = "Spartan !!!";

function warCry() {
let cry = "SPARTAN !!!";
console.log(cry);
}

// warCry();
// console.log(cry);

//sayHello("Jean-Patrick");
//addition(5, 9.4)

let nombreUn = 4, nombreDeux = 7;

function add(nombreA, nombreB) {
result = nombreA + nombreB;
return result;
}

// console.log(add(nombreUn, nombreDeux));

let preparation = 10, cooking = 15;

function cook(cakeNumber, preparationMinutes = 10, cookingMinutes = 15) {
let result = cakeNumber * (preparationMinutes + cookingMinutes);
return result;
}

// console.log(cook(5));

function sayAge() {
let age = prompt("How old are you ?")
age = Number(age);
alert("You are " + (age + 1));
}

// sayAge();

let functionAnonymous = function () {
console.log('I am an anonymous function');
}

// functionAnonymous();
(function () { console.log('I am an anonymous function') })

0 comments on commit 03cf587

Please sign in to comment.