initial commit

This commit is contained in:
2026-01-17 08:33:44 +01:00
commit 7920e8c4e5
9 changed files with 251 additions and 0 deletions

19
exercice1.ts Normal file
View File

@@ -0,0 +1,19 @@
function addition(a, b) {
return a + b;
}
console.log(addition(2, 3)); // attendu : 5
console.log(addition("2", 3)); // attendu : ?
console.log(addition(true, 3)); // attendu : ?
namespace Typed {
function addition(a: number, b: number): number {
return a + b;
}
console.log(addition(2, 3));
// L'argument de type 'string' n'est pas attribuable au paramètre de type 'number'.ts(2345)
console.log(addition("2", 3));
// L'argument de type 'boolean' n'est pas attribuable au paramètre de type 'number'.ts(2345)
console.log(addition(true, 3));
}