Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
function printName(name: string): void {
// write your code here
console.log(name);
}

/**
Expand All @@ -17,6 +18,13 @@ function printName(name: string): void {
*/
function printAge(birthYear: number): void {
// write your code here
const CurrentYear = new Date().getFullYear();
const Age = CurrentYear - birthYear;
// if(birthYear > CurrentYear){
// return 0;
// }
console.log(Age)
return Age; // replace -1 to what you see is fit
}

// example:
Expand All @@ -40,6 +48,19 @@ type LanguageType = "en" | "es" | "fr" | "tr";

function printHello(name: string, language: LanguageType): void {
// write your code here
var greeting : string = "";
switch(language){
case "en" : greeting = "Hello";
break;
case "es" : greeting = "Hola";
break;
case "fr" : greeting = "Bonjour";
break;
case "tr" : greeting = "Merhaba";
break;
default : greeting = "";
}
return `${greeting} ${name}`; // replace the empty string with what you see is fit
}

// example:
Expand All @@ -56,6 +77,9 @@ printHello("Aziz", "fr"); // => "Bonjour Aziz"
*/
function printMax(x: number, y: number) {
// write your code here
const maxValue = Math.max(x,y)
console.log(maxValue)
return maxValue; // replace -1 to what you see is fit
}

// example:
Expand Down
Loading