├── TS_NodeJS ├── FavoriteNumber │ ├── favoriteNumber.js │ └── favoriteNumber.ts ├── Names │ ├── names.js │ └── names.ts ├── NumberEight │ ├── numberEight.ts │ └── numberEight.js ├── T-Shirt │ ├── t-Shirt.js │ └── t-Shirt.ts ├── FamousQuote │ ├── famousQuote.js │ └── famousQuote.ts ├── PersonalMessage │ ├── personalMessage.js │ └── personalMessage.ts ├── StrippingNames │ ├── strippingNames.js │ └── strippingNames.ts ├── YourOwnArray │ ├── yourOwnArray.js │ └── yourOwnArray.ts ├── FamousQuote2 │ ├── famousQuote2.js │ └── famousQuote2.ts ├── AlienColors1 │ ├── alienColors1.js │ └── alienColors1.ts ├── CityNames │ ├── cityNames.js │ └── cityNames.ts ├── Cities │ ├── cities.js │ └── cities.ts ├── ThinkOfSomething │ ├── thinkOfSomething.js │ └── thinkOfSomething.ts ├── Animals │ ├── animals.ts │ └── animals.js ├── NameCases │ ├── nameCases.js │ └── nameCases.ts ├── InternationalError │ ├── internationalError.js │ └── internationalError.ts ├── Greetings │ ├── greetings.js │ └── greetings.ts ├── Magicians │ ├── magicians.js │ └── magicians.ts ├── LargeShirt │ ├── largeShirt.js │ └── largeShirt.ts ├── AlienColors2 │ ├── alienColors2.js │ └── alienColors2.ts ├── Album │ ├── album.js │ └── album.ts ├── HelloAdmin │ ├── helloAdmin.ts │ └── helloAdmin.js ├── Pizzas │ ├── pizzas.js │ └── pizzas.ts ├── OrdinalNumbers │ ├── ordinalNumbers.js │ └── ordinalNumbers.ts ├── NoUsers │ ├── noUsers.ts │ └── noUsers.js ├── StagesOfLife │ ├── stagesOfLife.js │ └── stagesOfLife.ts ├── Cars │ ├── cars.js │ └── cars.ts ├── AlienColors3 │ ├── alienColors3.js │ └── alienColors3.ts ├── GreatMagicians │ ├── greatMagicians.js │ └── greatMagicians.ts ├── CheckingUsernames │ ├── checkingUsernames.ts │ └── checkingUsernames.js ├── Sandwiches │ ├── sandwiches.js │ └── sandwiches.ts ├── GuestList │ ├── guestList.js │ └── guestList.ts ├── Store-in-a-TypeScript-Object │ ├── store-in-a-typeScript-object.js │ └── store-in-a-typeScript-object.ts ├── FavoriteFruit │ ├── favoriteFruit.js │ └── favoriteFruit.ts ├── AddingComments │ ├── addingComments.js │ └── addingComments.ts ├── MoreConditionalTests │ ├── moreConditionalTests.js │ └── moreConditionalTests.ts ├── SeeingTheWorld │ ├── seeingTheWorld.ts │ └── seeingTheWorld.js ├── ConditionalTests │ ├── conditionalTests.js │ └── conditionalTests.ts ├── UnchangedMagicians │ ├── unchangedMagicians.js │ └── unchangedMagicians.ts ├── DinnerGuests │ ├── dinnerGuests.js │ └── dinnerGuests.ts ├── ChangingGuestList │ ├── changingGuestList.js │ └── changingGuestList.ts ├── MoreGuest │ ├── MoreGuest.js │ └── moreGuest.ts ├── ShrinkingGuestList │ ├── shrinkingGuestList.js │ └── shrinkingGuestList.ts └── README.txt └── README.md /TS_NodeJS/FavoriteNumber/favoriteNumber.js: -------------------------------------------------------------------------------- 1 | var starMen = 6; 2 | var message = "One of my favorite number is ".concat(starMen); 3 | 4 | console.log(message); -------------------------------------------------------------------------------- /TS_NodeJS/Names/names.js: -------------------------------------------------------------------------------- 1 | var names = ["Python", "GitHub", "TypeScript", "Next.js"]; 2 | for (var S = 0; S < names.length; S++) { 3 | console.log(names[S]); 4 | } -------------------------------------------------------------------------------- /TS_NodeJS/FavoriteNumber/favoriteNumber.ts: -------------------------------------------------------------------------------- 1 | const starMen : number = 6; 2 | const message : string = `One of my favorite number is ${starMen}`; 3 | console.log(message); -------------------------------------------------------------------------------- /TS_NodeJS/Names/names.ts: -------------------------------------------------------------------------------- 1 | const names : string[] = ["Python","GitHub","TypeScript","Next.js"]; 2 | 3 | for (let S = 0; S < names.length; S++) 4 | { 5 | console.log(names[S]); 6 | } -------------------------------------------------------------------------------- /TS_NodeJS/NumberEight/numberEight.ts: -------------------------------------------------------------------------------- 1 | console.log(2+2+4); /* Addition */ 2 | console.log(10-2); /* Subtraction */ 3 | console.log(2*4); /* Multiplication */ 4 | console.log(16/2); /* Division */ -------------------------------------------------------------------------------- /TS_NodeJS/NumberEight/numberEight.js: -------------------------------------------------------------------------------- 1 | console.log(2 + 2 + 4); /* Addition */ 2 | console.log(10 - 2); /* Subtraction */ 3 | console.log(2 * 4); /* Multiplication */ 4 | console.log(16 / 2); /* Division */ 5 | -------------------------------------------------------------------------------- /TS_NodeJS/T-Shirt/t-Shirt.js: -------------------------------------------------------------------------------- 1 | function make_shirt(size, message) { 2 | console.log("Shirt size: ".concat(size, ", \nMessage: ").concat(message)); 3 | } 4 | make_shirt("XXL", "Health is Wealth :D"); 5 | -------------------------------------------------------------------------------- /TS_NodeJS/FamousQuote/famousQuote.js: -------------------------------------------------------------------------------- 1 | var quote1 = "A person who never made a mistake never tried anything new."; 2 | var author1 = "Albert Einstein"; 3 | 4 | console.log("".concat(author1, " once said, ").concat(quote1)); -------------------------------------------------------------------------------- /TS_NodeJS/PersonalMessage/personalMessage.js: -------------------------------------------------------------------------------- 1 | var nfm = "Eric"; 2 | console.log("Hello ".concat(nfm, ", would you like to learn some Python today?")); 3 | /* I'm using "nfm" as name variable, means Name For Message */ 4 | -------------------------------------------------------------------------------- /TS_NodeJS/PersonalMessage/personalMessage.ts: -------------------------------------------------------------------------------- 1 | const nfm : string = "Eric"; 2 | console.log(`Hello ${nfm}, would you like to learn some Python today?`) 3 | 4 | /* I'm using "nfm" as name variable, means Name For Message */ -------------------------------------------------------------------------------- /TS_NodeJS/FamousQuote/famousQuote.ts: -------------------------------------------------------------------------------- 1 | const quote1 : string = "A person who never made a mistake never tried anything new."; 2 | const author1 : string = "Albert Einstein"; 3 | 4 | console.log(`${author1} once said, ${quote1}`); -------------------------------------------------------------------------------- /TS_NodeJS/StrippingNames/strippingNames.js: -------------------------------------------------------------------------------- 1 | 2 | var name_along_spaces = "\n\t MUHAMMAD SALMAN HUSSAIN"; 3 | console.log("Name:", name_along_spaces); 4 | 5 | var name_trim_spaces = name_along_spaces.trim(); 6 | console.log("Name:", name_trim_spaces); -------------------------------------------------------------------------------- /TS_NodeJS/YourOwnArray/yourOwnArray.js: -------------------------------------------------------------------------------- 1 | var wishes = ["Helicopter", " Private Jet", " Cruise Ship", " $10,000,000 Private Island"]; 2 | for (var S = 0; S < wishes.length; S++) 3 | ; 4 | { 5 | console.log("I would like to own a ".concat(wishes, ".")); 6 | } -------------------------------------------------------------------------------- /TS_NodeJS/YourOwnArray/yourOwnArray.ts: -------------------------------------------------------------------------------- 1 | const wishes : string[] = ["Helicopter"," Private Jet"," Cruise Ship"," $10,000,000 Private Island"]; 2 | 3 | for (let S = 0; S < wishes.length; S++); 4 | { 5 | console.log(`I would like to own a ${wishes}.`); 6 | } -------------------------------------------------------------------------------- /TS_NodeJS/FamousQuote2/famousQuote2.js: -------------------------------------------------------------------------------- 1 | var quote = "A person who never made a mistake never tried anything new."; 2 | var famous_person = "Albert Einstein"; 3 | 4 | var message = "".concat(famous_person, " once said, \"").concat(quote, "\""); 5 | 6 | console.log(message); -------------------------------------------------------------------------------- /TS_NodeJS/StrippingNames/strippingNames.ts: -------------------------------------------------------------------------------- 1 | const name_along_spaces : string = "\n\t MUHAMMAD SALMAN HUSSAIN"; 2 | 3 | console.log("Name:", name_along_spaces); 4 | 5 | const name_trim_spaces : string = name_along_spaces.trim(); 6 | 7 | console.log("Name:", name_trim_spaces); -------------------------------------------------------------------------------- /TS_NodeJS/AlienColors1/alienColors1.js: -------------------------------------------------------------------------------- 1 | var alien_color = 'green'; 2 | if (alien_color === 'green') { 3 | console.log("You earned 5 Points."); 4 | } 5 | ; 6 | var alien_color = 'red'; 7 | if (alien_color === 'green') { 8 | console.log("You earned 5 Points."); 9 | } 10 | ; 11 | -------------------------------------------------------------------------------- /TS_NodeJS/CityNames/cityNames.js: -------------------------------------------------------------------------------- 1 | function city_country(city, country) { 2 | return "".concat(city, ", ").concat(country); 3 | } 4 | console.log(city_country("Istanbul", "Turkey")); 5 | console.log(city_country("Shanghai", "China")); 6 | console.log(city_country("Paris", "France")); 7 | -------------------------------------------------------------------------------- /TS_NodeJS/FamousQuote2/famousQuote2.ts: -------------------------------------------------------------------------------- 1 | const quote : string = "A person who never made a mistake never tried anything new."; 2 | const famous_person : string = "Albert Einstein"; 3 | 4 | const message : string = `${famous_person} once said, "${quote}"`; 5 | 6 | console.log(message); -------------------------------------------------------------------------------- /TS_NodeJS/T-Shirt/t-Shirt.ts: -------------------------------------------------------------------------------- 1 | function make_shirt 2 | ( 3 | size: string, 4 | message: string 5 | ) 6 | 7 | { 8 | console.log( 9 | `Shirt size: ${size}, \nMessage: ${message}`); 10 | } 11 | 12 | make_shirt("XXL", "Health is Wealth :D"); -------------------------------------------------------------------------------- /TS_NodeJS/Cities/cities.js: -------------------------------------------------------------------------------- 1 | function describe_city(city, country) { 2 | if (country === void 0) { country = "Pakistan"; } 3 | console.log("".concat(city, " is in ").concat(country, ".")); 4 | } 5 | describe_city("Karachi"); 6 | describe_city("Islamabad"); 7 | describe_city("Tokyo", "Japan"); 8 | -------------------------------------------------------------------------------- /TS_NodeJS/ThinkOfSomething/thinkOfSomething.js: -------------------------------------------------------------------------------- 1 | /* My Array of Programming Languages */ 2 | var programmingLanguages = ["Python", "MySQL", "GraphQL", "Kubernetes", "TypeScript", "TailwindCSS", "Docker"]; 3 | /* Print */ 4 | console.log("List of Programming Languages:"); 5 | console.log(programmingLanguages); 6 | -------------------------------------------------------------------------------- /TS_NodeJS/Animals/animals.ts: -------------------------------------------------------------------------------- 1 | const animals = ["Dog", "Squirrel", "Mongoose"]; 2 | 3 | 4 | for (const animal of animals) 5 | 6 | { 7 | 8 | console.log(`A ${animal.toLowerCase()} would make a great pet.`); 9 | 10 | } 11 | 12 | console.log("Any of these animals would make a great pet!"); -------------------------------------------------------------------------------- /TS_NodeJS/NameCases/nameCases.js: -------------------------------------------------------------------------------- 1 | var name1 = "Muhammad Salman Hussain"; 2 | 3 | var name1Upper = name1.toUpperCase(); 4 | var name1Lower = name1.toLowerCase(); 5 | var name1Title = name1; 6 | 7 | console.log("Name: ", name1Upper); 8 | console.log("Name: ", name1Lower); 9 | console.log("Name: ", name1Title); 10 | -------------------------------------------------------------------------------- /TS_NodeJS/ThinkOfSomething/thinkOfSomething.ts: -------------------------------------------------------------------------------- 1 | /* My Array of Programming Languages */ 2 | const programmingLanguages: string[] = ["Python", "MySQL", "GraphQL", "Kubernetes", "TypeScript","TailwindCSS","Docker"]; 3 | 4 | /* Print */ 5 | console.log("List of Programming Languages:"); 6 | console.log(programmingLanguages); -------------------------------------------------------------------------------- /TS_NodeJS/AlienColors1/alienColors1.ts: -------------------------------------------------------------------------------- 1 | let alien_color: string = 'green'; 2 | 3 | if (alien_color === 'green') 4 | { 5 | console.log("You earned 5 Points."); 6 | }; 7 | 8 | 9 | let alien_color: string = 'red'; 10 | 11 | if (alien_color === 'green') 12 | { 13 | console.log("You earned 5 Points."); 14 | }; -------------------------------------------------------------------------------- /TS_NodeJS/Animals/animals.js: -------------------------------------------------------------------------------- 1 | var animals = ["Dog", "Squirrel", "Mongoose"]; 2 | for (var _i = 0, animals_1 = animals; _i < animals_1.length; _i++) { 3 | var animal = animals_1[_i]; 4 | console.log("A ".concat(animal.toLowerCase(), " would make a great pet.")); 5 | } 6 | console.log("Any of these animals would make a great pet!"); 7 | -------------------------------------------------------------------------------- /TS_NodeJS/NameCases/nameCases.ts: -------------------------------------------------------------------------------- 1 | const name1 : string = "Muhammad Salman Hussain" 2 | 3 | const name1Upper : string = name1.toUpperCase(); 4 | const name1Lower : string = name1.toLowerCase(); 5 | const name1Title : string = name1 6 | 7 | console.log("Name: ", name1Upper); 8 | console.log("Name: ", name1Lower); 9 | console.log("Name: ", name1Title); -------------------------------------------------------------------------------- /TS_NodeJS/Cities/cities.ts: -------------------------------------------------------------------------------- 1 | function describe_city 2 | ( 3 | city: string, 4 | country: string = "Pakistan" 5 | ) 6 | { 7 | console.log(`${city} is in ${country}.`); 8 | } 9 | 10 | describe_city("Karachi"); 11 | 12 | describe_city("Islamabad"); 13 | 14 | describe_city("Tokyo", "Japan"); -------------------------------------------------------------------------------- /TS_NodeJS/InternationalError/internationalError.js: -------------------------------------------------------------------------------- 1 | /* Hollywood Hits ;) */ 2 | var movies = ["Avatar", "Titanic", "The Avengers", "The Dark Knight"]; 3 | console.log(movies[10]); /* ----> It's an Error of Indexing */ 4 | console.log(movies[2]); /* ----> Error Correction */ 5 | -------------------------------------------------------------------------------- /TS_NodeJS/Greetings/greetings.js: -------------------------------------------------------------------------------- 1 | var names = ["Python", "GitHub", "TypeScript", "Next.js"]; 2 | var message = "you are an amazing friend of my everyday career life.\nClean code always looks like it was written by someone who cares. — Robert C. Martin\n"; 3 | 4 | for (var i = 0; i < names.length; i++) { 5 | console.log("Hello ".concat(names[i], ", ").concat(message)); 6 | } -------------------------------------------------------------------------------- /TS_NodeJS/Greetings/greetings.ts: -------------------------------------------------------------------------------- 1 | const names: string[] = ["Python", "GitHub", "TypeScript", "Next.js"]; 2 | 3 | const message: string = "you are an amazing friend of my everyday career life.\nClean code always looks like it was written by someone who cares. — Robert C. Martin\n"; 4 | 5 | for (let i = 0; i < names.length; i++) { 6 | console.log(`Hello ${names[i]}, ${message}`);} -------------------------------------------------------------------------------- /TS_NodeJS/InternationalError/internationalError.ts: -------------------------------------------------------------------------------- 1 | /* Hollywood Hits ;) */ 2 | const movies: string[] = ["Avatar", "Titanic", "The Avengers", "The Dark Knight"]; 3 | 4 | console.log(movies[10]); /* ----> It's an Error of Indexing */ 5 | 6 | console.log(movies[2]); /* ----> Error Correction */ -------------------------------------------------------------------------------- /TS_NodeJS/Magicians/magicians.js: -------------------------------------------------------------------------------- 1 | function show_magicians(magicians) { 2 | magicians.forEach(function (magician) { return console.log(magician); }); 3 | return magicians; 4 | } 5 | var magicians = ["Jeff McBride (American Magician)", 6 | "Penn & Teller (American Magicians)", 7 | "Criss Angel (American Magicians)" 8 | ]; 9 | var magiciansName = show_magicians(magicians); 10 | -------------------------------------------------------------------------------- /TS_NodeJS/LargeShirt/largeShirt.js: -------------------------------------------------------------------------------- 1 | function make_shirt(size, message) { 2 | if (size === void 0) { size = "large"; } 3 | if (message === void 0) { message = "I love TypeScript"; } 4 | console.log("Shirt size: ".concat(size.toUpperCase(), ", Message: ").concat(message)); 5 | } 6 | make_shirt(); 7 | make_shirt("Medium", "I love Python"); 8 | make_shirt("Small", "Programming is Awesome!"); 9 | -------------------------------------------------------------------------------- /TS_NodeJS/AlienColors2/alienColors2.js: -------------------------------------------------------------------------------- 1 | var alien_color = 'green'; 2 | if (alien_color === 'green') { 3 | console.log("You earned 5 Points."); 4 | } 5 | else { 6 | console.log("You earned 10 Points."); 7 | } 8 | ; 9 | var alien_color2 = 'red'; 10 | if (alien_color2 === 'green') { 11 | console.log("You earned 5 Points."); 12 | } 13 | else { 14 | console.log("You earned 10 Points."); 15 | } 16 | ; 17 | -------------------------------------------------------------------------------- /TS_NodeJS/Album/album.js: -------------------------------------------------------------------------------- 1 | function makeAlbum(artist, title, tracks) { 2 | return { artist: artist, title: title, tracks: tracks }; 3 | } 4 | var album1 = makeAlbum("Justin Bieber", "My World 2.O", 10); 5 | var album2 = makeAlbum("Ed Sheeran and Rudimental", "x (Wembley Edition)", 24); 6 | var album3 = makeAlbum("Lady Gaga", "The Fame", 15); 7 | console.log(album1); 8 | console.log(album2); 9 | console.log(album3); 10 | -------------------------------------------------------------------------------- /TS_NodeJS/HelloAdmin/helloAdmin.ts: -------------------------------------------------------------------------------- 1 | let usernames: string[] = ["admin", "admin", "Salman", "Sheikh", "newuser3", "newuser4"]; 2 | 3 | 4 | for (let username of usernames) 5 | { 6 | if (username === "admin") 7 | { 8 | console.log("Hello admin, would you like to see a status report?"); 9 | } 10 | 11 | else { 12 | console.log(`Hello ${username}, thank you for logging in again.`); 13 | } 14 | } -------------------------------------------------------------------------------- /TS_NodeJS/CityNames/cityNames.ts: -------------------------------------------------------------------------------- 1 | function city_country 2 | ( 3 | city: string, 4 | country: string 5 | ): 6 | string 7 | { 8 | return `${city}, ${country}`; 9 | } 10 | 11 | console.log( 12 | city_country("Istanbul", "Turkey") 13 | ); 14 | 15 | console.log( 16 | city_country("Shanghai", "China") 17 | ); 18 | 19 | console.log( 20 | city_country("Paris", "France") 21 | ); -------------------------------------------------------------------------------- /TS_NodeJS/LargeShirt/largeShirt.ts: -------------------------------------------------------------------------------- 1 | function make_shirt 2 | ( 3 | size: string = "large", 4 | message: string = "I love TypeScript" 5 | ) 6 | 7 | { 8 | console.log( 9 | `Shirt size: ${size.toUpperCase()}, Message: ${message}`); 10 | } 11 | 12 | make_shirt(); 13 | 14 | make_shirt("Medium", "I love Python"); 15 | 16 | make_shirt("Small", "Programming is Awesome!"); -------------------------------------------------------------------------------- /TS_NodeJS/Pizzas/pizzas.js: -------------------------------------------------------------------------------- 1 | var pizzas = [ 2 | "California", 3 | "Cheese", 4 | "BBQ Chicken", 5 | "Pepperoni" 6 | ]; 7 | for (var _i = 0, pizzas_1 = pizzas; _i < pizzas_1.length; _i++) { 8 | var pizza = pizzas_1[_i]; 9 | console.log("Mmm, I'm craving ".concat(pizza, " pizza right now!")); 10 | } 11 | console.log("I fell asleep with a pizza in the oven today! Burned 2000 calories... joke! XD"); 12 | console.log("Seriously, pizza is the best to get!"); 13 | -------------------------------------------------------------------------------- /TS_NodeJS/AlienColors2/alienColors2.ts: -------------------------------------------------------------------------------- 1 | let alien_color: string = 'green'; 2 | 3 | if (alien_color === 'green') 4 | { 5 | console.log("You earned 5 Points."); 6 | } 7 | 8 | else { 9 | console.log("You earned 10 Points."); 10 | }; 11 | 12 | let alien_color2: string = 'red'; 13 | 14 | if (alien_color2 === 'green') 15 | { 16 | console.log("You earned 5 Points."); 17 | } 18 | else { 19 | console.log("You earned 10 Points."); 20 | }; -------------------------------------------------------------------------------- /TS_NodeJS/HelloAdmin/helloAdmin.js: -------------------------------------------------------------------------------- 1 | var usernames = ["admin", "admin", "Salman", "Sheikh", "newuser3", "newuser4"]; 2 | for (var _i = 0, usernames_1 = usernames; _i < usernames_1.length; _i++) { 3 | var username = usernames_1[_i]; 4 | if (username === "admin") { 5 | console.log("Hello admin, would you like to see a status report?"); 6 | } 7 | else { 8 | console.log("Hello ".concat(username, ", thank you for logging in again.")); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /TS_NodeJS/OrdinalNumbers/ordinalNumbers.js: -------------------------------------------------------------------------------- 1 | var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]; 2 | for (var _i = 0, numbers_1 = numbers; _i < numbers_1.length; _i++) { 3 | var number = numbers_1[_i]; 4 | var ending = void 0; 5 | if (number === 1) 6 | ending = 'st'; 7 | else if (number === 2) 8 | ending = 'nd'; 9 | else if (number === 3) 10 | ending = 'rd'; 11 | else 12 | ending = 'th'; 13 | console.log("".concat(number).concat(ending)); 14 | } 15 | -------------------------------------------------------------------------------- /TS_NodeJS/OrdinalNumbers/ordinalNumbers.ts: -------------------------------------------------------------------------------- 1 | const numbers: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9]; 2 | 3 | for (const number of numbers) 4 | 5 | { 6 | let ending: string; 7 | 8 | if (number === 1) ending = 'st'; 9 | else if 10 | (number === 2) ending = 'nd'; 11 | else if 12 | (number === 3) ending = 'rd'; 13 | else ending = 'th'; 14 | 15 | console.log(`${number}${ending}`); 16 | } -------------------------------------------------------------------------------- /TS_NodeJS/NoUsers/noUsers.ts: -------------------------------------------------------------------------------- 1 | let usernames: string[] = ["admin", "admin", "Salman", "Sheikh", "user3", "user4"]; 2 | 3 | if (usernames.length === 0) 4 | { 5 | console.log("We need to find some users!"); 6 | } 7 | 8 | else 9 | { 10 | for (let username of usernames) 11 | { 12 | console.log(username === "admin" ? 13 | "Hello admin, would you like to see a status report?" 14 | : 15 | `Hello ${username}, thank you for logging in again.`); 16 | } 17 | } -------------------------------------------------------------------------------- /TS_NodeJS/Pizzas/pizzas.ts: -------------------------------------------------------------------------------- 1 | const pizzas = 2 | [ 3 | "California", 4 | "Cheese", 5 | "BBQ Chicken", 6 | "Pepperoni" 7 | ]; 8 | 9 | for (const pizza of pizzas) 10 | 11 | { 12 | console.log(`Mmm, I'm craving ${pizza} pizza right now!`); 13 | } 14 | 15 | console.log("I fell asleep with a pizza in the oven today! Burned 2000 calories... joke! XD"); 16 | console.log("Seriously, pizza is the best to get!"); -------------------------------------------------------------------------------- /TS_NodeJS/StagesOfLife/stagesOfLife.js: -------------------------------------------------------------------------------- 1 | var age = 25; 2 | if (age < 2) { 3 | console.log("This human is a baby."); 4 | } 5 | else if (age >= 2 && age < 4) { 6 | console.log("This human is a toddler."); 7 | } 8 | else if (age >= 4 && age < 13) { 9 | console.log("This human is a kid."); 10 | } 11 | else if (age >= 13 && age < 20) { 12 | console.log("This human is a teenager."); 13 | } 14 | else if (age >= 20 && age < 65) { 15 | console.log("This human is an adult."); 16 | } 17 | else { 18 | console.log("This human is an elder."); 19 | } 20 | -------------------------------------------------------------------------------- /TS_NodeJS/NoUsers/noUsers.js: -------------------------------------------------------------------------------- 1 | var usernames = ["admin", "admin", "Salman", "Sheikh", "user3", "user4"]; 2 | if (usernames.length === 0) { 3 | console.log("We need to find some users!"); 4 | } 5 | else { 6 | for (var _i = 0, usernames_1 = usernames; _i < usernames_1.length; _i++) { 7 | var username = usernames_1[_i]; 8 | console.log(username === "admin" ? 9 | "Hello admin, would you like to see a status report?" 10 | : 11 | "Hello ".concat(username, ", thank you for logging in again.")); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /TS_NodeJS/Magicians/magicians.ts: -------------------------------------------------------------------------------- 1 | function show_magicians 2 | ( 3 | magicians: string[] 4 | ): 5 | string[] 6 | { 7 | 8 | magicians.forEach( 9 | magician => console.log(magician) 10 | ); 11 | return magicians; 12 | 13 | } 14 | 15 | const magicians: string[] 16 | = ["Jeff McBride (American Magician)", 17 | "Penn & Teller (American Magicians)", 18 | "Criss Angel (American Magicians)" 19 | ]; 20 | 21 | const magiciansName 22 | = show_magicians(magicians); -------------------------------------------------------------------------------- /TS_NodeJS/Cars/cars.js: -------------------------------------------------------------------------------- 1 | function createCar(manufacturer, modelName) { 2 | var options = []; 3 | for (var _i = 2; _i < arguments.length; _i++) { 4 | options[_i - 2] = arguments[_i]; 5 | } 6 | var car = { 7 | manufacturer: manufacturer, 8 | modelName: modelName 9 | }; 10 | options.forEach(function (option) { 11 | Object.keys(option).forEach(function (key) { 12 | car[key] = option[key]; 13 | }); 14 | }); 15 | return car; 16 | } 17 | var carInfo = createCar("Honda", "Civic 2024", { color: "blue", sunroof: true }); 18 | console.log(carInfo); 19 | -------------------------------------------------------------------------------- /TS_NodeJS/Album/album.ts: -------------------------------------------------------------------------------- 1 | function 2 | makeAlbum 3 | ( 4 | artist: string, 5 | title: string, 6 | tracks?: number 7 | ): 8 | 9 | Record 10 | { 11 | return { artist, title, tracks }; 12 | } 13 | 14 | const album1 15 | = makeAlbum("Justin Bieber", "My World 2.O", 10); 16 | 17 | const album2 18 | = makeAlbum("Ed Sheeran and Rudimental", "x (Wembley Edition)", 24); 19 | 20 | const album3 21 | = makeAlbum("Lady Gaga", "The Fame", 15); 22 | 23 | 24 | console.log(album1); console.log(album2); console.log(album3); -------------------------------------------------------------------------------- /TS_NodeJS/AlienColors3/alienColors3.js: -------------------------------------------------------------------------------- 1 | var Points = function (color, points) { 2 | console.log("You earned ".concat(points, " Points.")); 3 | }; 4 | var AlienColor = function (color) { 5 | switch (color) { 6 | case 'green': 7 | Points(color, 5); 8 | break; 9 | case 'yellow': 10 | Points(color, 10); 11 | break; 12 | case 'red': 13 | Points(color, 15); 14 | break; 15 | default: 16 | console.log("Unknown alien color."); 17 | } 18 | }; 19 | AlienColor('green'); 20 | AlienColor('yellow'); 21 | AlienColor('red'); 22 | -------------------------------------------------------------------------------- /TS_NodeJS/GreatMagicians/greatMagicians.js: -------------------------------------------------------------------------------- 1 | function make_great(magicians) { 2 | return magicians.map(function (magician) { return "the Great ".concat(magician); }); 3 | } 4 | function show_magicians(magicians) { 5 | magicians.forEach(function (magician) { return console.log(magician); }); 6 | return magicians; 7 | } 8 | var magicians = [ 9 | "Jeff McBride (American Magician)", 10 | "Penn & Teller (American Magicians)", 11 | "Criss Angel (American Magicians)" 12 | ]; 13 | var greatMagicians = make_great(magicians); 14 | var displayedMagicians = show_magicians(greatMagicians); 15 | console.log(displayedMagicians); 16 | -------------------------------------------------------------------------------- /TS_NodeJS/CheckingUsernames/checkingUsernames.ts: -------------------------------------------------------------------------------- 1 | const currentUsers: string[] = 2 | ["Salman", "Muhammad Salman Hussain", "Salman Hussain", "Salman Sheikh", "nouser-John"]; 3 | 4 | const newUsers: string[] = 5 | ["Muhammad Salman Hussain", "MSHSheikh", "Salman Sheikh", "M. Salman Hussain", "NOUSER-JOHN"]; 6 | 7 | for (const newUser of newUsers) 8 | { 9 | const isExisting = currentUsers.some(user => user.toLowerCase() === newUser.toLowerCase()); 10 | 11 | const message = isExisting ? "Please enter a new username." 12 | : 13 | "Username is available."; 14 | 15 | console.log(`"${newUser}" - ${message}`); 16 | } -------------------------------------------------------------------------------- /TS_NodeJS/Sandwiches/sandwiches.js: -------------------------------------------------------------------------------- 1 | function makeSandwich() { 2 | var toppings = []; 3 | for (var _i = 0; _i < arguments.length; _i++) { 4 | toppings[_i] = arguments[_i]; 5 | } 6 | console.log("Making a sandwich with the following toppings:"); 7 | for (var _a = 0, toppings_1 = toppings; _a < toppings_1.length; _a++) { 8 | var topping = toppings_1[_a]; 9 | console.log("- " + topping); 10 | } 11 | console.log("Sandwich is ready!\n"); 12 | return toppings; 13 | } 14 | makeSandwich("Chicken", "Cheddar", "Spinach", "Onion"); 15 | makeSandwich("Beef", "Mozzarella", "Peppers"); 16 | makeSandwich("Peanut Butter", "Jam"); 17 | -------------------------------------------------------------------------------- /TS_NodeJS/GuestList/guestList.js: -------------------------------------------------------------------------------- 1 | var specialGuests = ["Sir Daniyal Nagori", "Sir Zia Khan", "Sir Muhammad Qasim"]; 2 | specialGuests.forEach(function (guest) { 3 | var specialMessage = "\nAssalam-o-Alaikum\n Dear ".concat(guest, ",\n\n I'm writing to extand a warm invitation to you for a dinner gathering at my place.\n\n It would be an honor to have you join us for an evening filed with delightful conversation and delicious food.\n Your presence would greatly enrich our gathering.\n\n Please let me know if you are coming to attend.\n\n Warm regards,\n Muhammad Salman Hussain\n\n "); 4 | console.log(specialMessage); 5 | } 6 | ); -------------------------------------------------------------------------------- /TS_NodeJS/Sandwiches/sandwiches.ts: -------------------------------------------------------------------------------- 1 | function 2 | makeSandwich 3 | (...toppings: any[]): any[] 4 | { 5 | console.log("Making a sandwich with the following toppings:"); 6 | for ( 7 | const topping of toppings 8 | ) 9 | 10 | { 11 | console.log("- " + topping); 12 | } 13 | 14 | console.log 15 | ("Sandwich is ready!\n"); 16 | 17 | return toppings; 18 | 19 | } 20 | 21 | makeSandwich 22 | ("Chicken", "Cheddar", "Spinach", "Onion"); 23 | makeSandwich 24 | ("Beef", "Mozzarella", "Peppers"); 25 | makeSandwich 26 | ("Peanut Butter", "Jam"); -------------------------------------------------------------------------------- /TS_NodeJS/Store-in-a-TypeScript-Object/store-in-a-typeScript-object.js: -------------------------------------------------------------------------------- 1 | /* Information About Some Cars */ 2 | var vehicle1 = { 3 | brand: "Toyota", 4 | model: "Camry", 5 | year: 2022, 6 | color: "Silver", 7 | price: "$25000" 8 | }; 9 | var vehicle2 = { 10 | brand: "Tesla", 11 | model: "Model 3", 12 | year: 2023, 13 | color: "Red", 14 | price: "$45000" 15 | }; 16 | var vehicle3 = { 17 | brand: "Honda", 18 | model: "Civic", 19 | year: 2021, 20 | color: "Blue", 21 | price: "$22000" 22 | }; 23 | // Print the information about the cars 24 | console.log("Information About Some Cars:"); 25 | console.log(vehicle1); 26 | console.log(vehicle2); 27 | console.log(vehicle3); 28 | -------------------------------------------------------------------------------- /TS_NodeJS/StagesOfLife/stagesOfLife.ts: -------------------------------------------------------------------------------- 1 | let age: number = 25; 2 | 3 | if (age < 2) 4 | 5 | { 6 | console.log("This human is a baby."); 7 | } 8 | 9 | else if (age >= 2 && age < 4) 10 | { 11 | console.log("This human is a toddler."); 12 | } 13 | 14 | else if (age >= 4 && age < 13) 15 | { 16 | console.log("This human is a kid."); 17 | } 18 | 19 | else if (age >= 13 && age < 20) 20 | { 21 | console.log("This human is a teenager."); 22 | } 23 | 24 | else if (age >= 20 && age < 65) 25 | { 26 | console.log("This human is an adult."); 27 | } 28 | 29 | else 30 | { 31 | console.log("This human is an elder."); 32 | } -------------------------------------------------------------------------------- /TS_NodeJS/FavoriteFruit/favoriteFruit.js: -------------------------------------------------------------------------------- 1 | var favorite_fruits = ["Drupe", "Peach", "Orange"]; 2 | if (favorite_fruits.includes("Drupe")) { 3 | console.log("You really like Drupes!"); 4 | } 5 | if (favorite_fruits.includes("Peach")) { 6 | console.log("You really like Peaches!"); 7 | } 8 | if (favorite_fruits.includes("Orange")) { 9 | console.log("You really like Oranges!"); 10 | } 11 | if (favorite_fruits.includes("mountain papaya")) { 12 | console.log("You don't like Mountain Papayas."); 13 | } 14 | else { 15 | console.log("You don't like Mountain Papayas."); 16 | } 17 | if (favorite_fruits.includes("Durian")) { 18 | console.log("You don't like Durians."); 19 | } 20 | else { 21 | console.log("You don't like Durians."); 22 | } 23 | -------------------------------------------------------------------------------- /TS_NodeJS/CheckingUsernames/checkingUsernames.js: -------------------------------------------------------------------------------- 1 | var currentUsers = ["Salman", "Muhammad Salman Hussain", "Salman Hussain", "Salman Sheikh", "nouser-John"]; 2 | var newUsers = ["Muhammad Salman Hussain", "MSHSheikh", "Salman Sheikh", "M. Salman Hussain", "NOUSER-JOHN"]; 3 | var _loop_1 = function (newUser) { 4 | var isExisting = currentUsers.some(function (user) { return user.toLowerCase() === newUser.toLowerCase(); }); 5 | var message = isExisting ? "Please enter a new username." 6 | : 7 | "Username is available."; 8 | console.log("\"".concat(newUser, "\" - ").concat(message)); 9 | }; 10 | for (var _i = 0, newUsers_1 = newUsers; _i < newUsers_1.length; _i++) { 11 | var newUser = newUsers_1[_i]; 12 | _loop_1(newUser); 13 | } 14 | -------------------------------------------------------------------------------- /TS_NodeJS/AddingComments/addingComments.js: -------------------------------------------------------------------------------- 1 | /* Coder's Name: MUHAMMAD SALMAN HUSSAIN 2 | Coder's LinkedIn Profile: in/mshsheikh 3 | Date of Code: 18th Feb. 2024 */ 4 | var weather_C = 20; 5 | /* Now, I'm converting Celsius to Fahrenheit */ 6 | var weather_F = (weather_C * 9 / 5) + 32; 7 | var report = "".concat(weather_C, " \u00B0C is = ").concat(weather_F.toFixed(2), " \u00B0F."); 8 | /* Printing Report... */ 9 | console.log(report); 10 | /* =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= */ 11 | var quote1 = "A person who never made a mistake never tried anything new."; 12 | var author1 = "Albert Einstein"; 13 | console.log("".concat(author1, " once said, ").concat(quote1)); 14 | /* This console will display Albert's complete message with his name */ -------------------------------------------------------------------------------- /TS_NodeJS/GuestList/guestList.ts: -------------------------------------------------------------------------------- 1 | const specialGuests : string[] = ["Sir Daniyal Nagori" , "Sir Zia Khan" , "Sir Muhammad Qasim"]; 2 | 3 | specialGuests.forEach(guest => { 4 | const specialMessage : string = 5 | `\nAssalam-o-Alaikum 6 | Dear ${guest}, 7 | 8 | I'm writing to extand a warm invitation to you for a dinner gathering at my place. 9 | 10 | It would be an honor to have you join us for an evening filed with delightful conversation and delicious food. 11 | Your presence would greatly enrich our gathering. 12 | 13 | Please let me know if you are coming to attend. 14 | 15 | Warm regards, 16 | Muhammad Salman Hussain\n 17 | ` 18 | console.log(specialMessage); 19 | } 20 | ); -------------------------------------------------------------------------------- /TS_NodeJS/Store-in-a-TypeScript-Object/store-in-a-typeScript-object.ts: -------------------------------------------------------------------------------- 1 | /* Information About Some Cars */ 2 | 3 | const vehicle1 = { 4 | brand: "Toyota", 5 | model: "Camry", 6 | year: 2022, 7 | color: "Silver", 8 | price: "$25000" 9 | }; 10 | 11 | const vehicle2 = { 12 | brand: "Tesla", 13 | model: "Model 3", 14 | year: 2023, 15 | color: "Red", 16 | price: "$45000" 17 | }; 18 | 19 | const vehicle3 = { 20 | brand: "Honda", 21 | model: "Civic", 22 | year: 2021, 23 | color: "Blue", 24 | price: "$22000" 25 | }; 26 | 27 | // Print the information about the cars 28 | console.log("Information About Some Cars:"); 29 | console.log(vehicle1); 30 | console.log(vehicle2); 31 | console.log(vehicle3); 32 | -------------------------------------------------------------------------------- /TS_NodeJS/AddingComments/addingComments.ts: -------------------------------------------------------------------------------- 1 | /* Coder's Name: MUHAMMAD SALMAN HUSSAIN 2 | Coder's LinkedIn Profile: in/mshsheikh 3 | Date of Code: 18th Feb. 2024 */ 4 | 5 | const weather_C : number = 20; 6 | 7 | /* Now, I'm converting Celsius to Fahrenheit */ 8 | 9 | const weather_F : number = (weather_C * 9/5) + 32; 10 | 11 | const report : string = `${weather_C} °C is = ${weather_F.toFixed(2)} °F.`; 12 | 13 | /* Printing Report... */ 14 | 15 | console.log(report); 16 | 17 | 18 | /* =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= */ 19 | 20 | 21 | const quote1 : string = "A person who never made a mistake never tried anything new."; 22 | const author1 : string = "Albert Einstein"; 23 | 24 | console.log(`${author1} once said, ${quote1}`); 25 | /* This console will display Albert's complete message with his name */ 26 | -------------------------------------------------------------------------------- /TS_NodeJS/AlienColors3/alienColors3.ts: -------------------------------------------------------------------------------- 1 | const Points = 2 | (color: string, points: number): 3 | void => { 4 | console.log(`You earned ${points} Points.`); 5 | }; 6 | 7 | const AlienColor = (color: string): 8 | 9 | void => { 10 | switch (color) 11 | { 12 | case 'green': 13 | Points(color, 5); 14 | break; 15 | 16 | case 'yellow': 17 | Points(color, 10); 18 | break; 19 | 20 | case 'red': 21 | Points(color, 15); 22 | break; 23 | 24 | default: 25 | console.log("Unknown alien color."); 26 | }}; 27 | 28 | AlienColor('green'); AlienColor('yellow'); AlienColor('red'); -------------------------------------------------------------------------------- /TS_NodeJS/FavoriteFruit/favoriteFruit.ts: -------------------------------------------------------------------------------- 1 | let favorite_fruits: string[] = ["Drupe", "Peach", "Orange"]; 2 | 3 | if (favorite_fruits.includes("Drupe")) 4 | { 5 | console.log("You really like Drupes!"); 6 | } 7 | 8 | if (favorite_fruits.includes("Peach")) 9 | { 10 | console.log("You really like Peaches!"); 11 | } 12 | 13 | if (favorite_fruits.includes("Orange")) 14 | { 15 | console.log("You really like Oranges!"); 16 | } 17 | 18 | if (favorite_fruits.includes("mountain papaya")) 19 | { 20 | console.log("You don't like Mountain Papayas."); 21 | } 22 | else { 23 | console.log("You don't like Mountain Papayas."); 24 | } 25 | 26 | if (favorite_fruits.includes("Durian")) 27 | { 28 | console.log("You don't like Durians."); 29 | } 30 | else { 31 | console.log("You don't like Durians."); 32 | } -------------------------------------------------------------------------------- /TS_NodeJS/GreatMagicians/greatMagicians.ts: -------------------------------------------------------------------------------- 1 | function 2 | make_great 3 | ( 4 | magicians: string[] 5 | ): 6 | string[] 7 | { 8 | return magicians.map( 9 | magician => `the Great ${magician}`); 10 | } 11 | 12 | function 13 | show_magicians 14 | ( 15 | magicians: string[] 16 | ): 17 | string[] 18 | { 19 | magicians.forEach( 20 | magician => console.log(magician)); 21 | 22 | return magicians; 23 | } 24 | 25 | const magicians: string[] = 26 | [ 27 | "Jeff McBride (American Magician)", 28 | "Penn & Teller (American Magicians)", 29 | "Criss Angel (American Magicians)" 30 | ]; 31 | 32 | const greatMagicians 33 | = make_great(magicians); 34 | const displayedMagicians 35 | = show_magicians(greatMagicians); 36 | 37 | console.log(displayedMagicians); -------------------------------------------------------------------------------- /TS_NodeJS/MoreConditionalTests/moreConditionalTests.js: -------------------------------------------------------------------------------- 1 | var name1 = 'salman'; 2 | var name2 = 'Salman'; 3 | console.log("(toLowerCase) function: ", name1.toLowerCase() === name2.toLowerCase()); 4 | var car1 = 'REVO'; 5 | var car2 = 'Civic'; 6 | console.log("Equality with strings: ", car1 == car2); 7 | console.log("Inequality with strings: ", car1 != car2); 8 | var colors = ['blue', 'white', 'black', 'silver']; 9 | console.log("Item is in the array: ", colors.includes('blue')); 10 | console.log("Item is not in the array: ", !colors.includes('yellow')); 11 | var num1 = 92.46; 12 | var num2 = 92.42; 13 | console.log("Numerical equality: ", num1 === num2); 14 | console.log("Numerical inequality: ", num1 !== num2); 15 | console.log("Numerical greater than: ", num1 > num2); 16 | console.log("Numerical less than: ", num1 < num2); 17 | console.log("Numerical greater than or equal to: ", num1 >= num2); 18 | console.log("Numerical less than or equal to: ", num1 <= num2); 19 | var x = 40; 20 | var y = 30; 21 | var z = 60; 22 | console.log("Using 'and' operator: ", x > y && x < z); 23 | console.log("Using 'or' operator: ", x < y || x > z); 24 | -------------------------------------------------------------------------------- /TS_NodeJS/SeeingTheWorld/seeingTheWorld.ts: -------------------------------------------------------------------------------- 1 | const inNext5Years: string[] = ["UAE", "Qatar", "Australia", "Finland", "USA"]; 2 | 3 | console.log("Original Style:"); 4 | console.log(inNext5Years); 5 | 6 | console.log("\nAlphabetical Style (without modification):"); 7 | console.log([...inNext5Years].sort()); 8 | 9 | console.log("\nArray is still in its original style:"); 10 | console.log(inNext5Years); 11 | 12 | console.log("\nReverse alphabetical order (without modification):"); 13 | console.log([...inNext5Years].sort().reverse()); 14 | 15 | console.log("\nArray is still in its original style:"); 16 | console.log(inNext5Years); 17 | 18 | inNext5Years.reverse(); 19 | console.log("\nReversed style:"); 20 | console.log(inNext5Years); 21 | 22 | inNext5Years.reverse(); 23 | console.log("\nBack to original style:"); 24 | console.log(inNext5Years); 25 | 26 | inNext5Years.sort(); 27 | console.log("\nSorted in alphabetical style:"); 28 | console.log(inNext5Years); 29 | 30 | inNext5Years.sort((a, b) => b.localeCompare(a)); 31 | console.log("\nSorted in reverse alphabetical style:"); 32 | console.log(inNext5Years); -------------------------------------------------------------------------------- /TS_NodeJS/ConditionalTests/conditionalTests.js: -------------------------------------------------------------------------------- 1 | var car = 'subaru'; 2 | /* CarTest 1 */ 3 | console.log("Is car equal to 'subaru'? Result:", car == 'subar'); 4 | /* CarTest 2 */ 5 | console.log("Is car not equal to 'toyota'? Result:", car != 'subaru'); 6 | /* CarTest 3 */ 7 | console.log("Is car equal to 'Subaru' (case-sensitive)? Result:", car === 'Subaru'); 8 | /* CarTest 4 */ 9 | console.log("Is car equal to 'subaru' (case-insensitive)? Result:", car.toLowerCase() === 'suBaru'); 10 | /* CarTest 5 */ 11 | console.log("Is car greater than 'BMW' (alphabetical order)? Result:", car > 'BMW'); 12 | /* CarTest 6 */ 13 | console.log("Is car less than or equal to 'Mercedes-Benz' (alphabetical order)? Result:", car <= 'REVO'); 14 | /* CarTest 7 */ 15 | console.log("Does car start with 'sub'? Result:", car.startsWith('sub')); 16 | /* CarTest 8 */ 17 | console.log("Does car end with 'aru'? Result:", car.endsWith('aru')); 18 | /* CarTest 9 */ 19 | console.log("Is the length of car equal to 6? Result:", car.length === 6); 20 | /* CarTest 10 */ 21 | console.log("Does car contain the letter 'u'? Result:", car.includes('u')); 22 | /* 23 | 10 Tests Completed 24 | */ 25 | -------------------------------------------------------------------------------- /TS_NodeJS/UnchangedMagicians/unchangedMagicians.js: -------------------------------------------------------------------------------- 1 | function makeGreatMagicians(magicians) { 2 | var greatMagicians = []; 3 | for (var _i = 0, magicians_1 = magicians; _i < magicians_1.length; _i++) { 4 | var magician = magicians_1[_i]; 5 | greatMagicians.push("the Great ".concat(magician)); 6 | } 7 | return greatMagicians; 8 | } 9 | function showMagicians(magicians) { 10 | var displayedMagicians = []; 11 | for (var _i = 0, magicians_2 = magicians; _i < magicians_2.length; _i++) { 12 | var magician = magicians_2[_i]; 13 | displayedMagicians.push(magician); 14 | console.log(magician); 15 | } 16 | return displayedMagicians; 17 | } 18 | var magicians = [ 19 | "Jeff McBride (American Magician)", 20 | "Penn & Teller (American Magicians)", 21 | "Criss Angel (American Magicians)" 22 | ]; 23 | var copiedMagicians = magicians.slice(); 24 | var greatMagicians = makeGreatMagicians(copiedMagicians); 25 | console.log("Original Magicians:"); 26 | var originalMagicians = showMagicians(magicians); 27 | console.log("\nGreat Magicians:"); 28 | var modifiedMagicians = showMagicians(greatMagicians); 29 | console.log(originalMagicians); 30 | console.log(modifiedMagicians); 31 | -------------------------------------------------------------------------------- /TS_NodeJS/Cars/cars.ts: -------------------------------------------------------------------------------- 1 | function 2 | createCar( 3 | manufacturer: string, 4 | modelName: string, 5 | ...options: { [key: string]: any }[] 6 | ): 7 | 8 | { 9 | manufacturer: string, 10 | modelName: string, [key: string]: any 11 | } 12 | 13 | { 14 | const car: { 15 | manufacturer: string, 16 | modelName: string, [key: string]: any 17 | } 18 | = { 19 | manufacturer, 20 | modelName 21 | }; 22 | 23 | 24 | options.forEach 25 | ( 26 | option => { 27 | Object.keys(option).forEach(key => {car[key] = option[key]; 28 | } 29 | ); 30 | } 31 | ); 32 | return car; 33 | } 34 | 35 | const carInfo 36 | = createCar("Honda", "Civic 2024", 37 | { color: "blue", sunroof: true } 38 | ); 39 | 40 | console.log(carInfo); -------------------------------------------------------------------------------- /TS_NodeJS/MoreConditionalTests/moreConditionalTests.ts: -------------------------------------------------------------------------------- 1 | let name1 = 'salman'; 2 | let name2 = 'Salman'; 3 | 4 | console.log( 5 | "(toLowerCase) function: ", 6 | name1.toLowerCase() === name2.toLowerCase() 7 | ); 8 | 9 | 10 | 11 | let car1 = 'REVO'; 12 | let car2 = 'Civic'; 13 | 14 | console.log( 15 | "Equality with strings: ", 16 | car1 == car2 17 | ); 18 | 19 | console.log( 20 | "Inequality with strings: ", 21 | car1 != car2 22 | ); 23 | 24 | 25 | 26 | let colors = ['blue', 'white', 'black', 'silver']; 27 | 28 | console.log("Item is in the array: ", colors.includes('blue')); 29 | console.log("Item is not in the array: ", !colors.includes('yellow')); 30 | 31 | 32 | 33 | let num1 = 92.46; 34 | let num2 = 92.42; 35 | 36 | console.log("Numerical equality: ", 37 | num1 === num2); 38 | console.log("Numerical inequality: ", 39 | num1 !== num2); 40 | console.log("Numerical greater than: ", 41 | num1 > num2); 42 | console.log("Numerical less than: ", 43 | num1 < num2); 44 | console.log("Numerical greater than or equal to: ", 45 | num1 >= num2); 46 | console.log("Numerical less than or equal to: ", 47 | num1 <= num2); 48 | 49 | 50 | 51 | let x = 40; 52 | let y = 30; 53 | let z = 60; 54 | 55 | console.log("Using 'and' operator: ", x > y && x < z); 56 | console.log("Using 'or' operator: ", x < y || x > z); -------------------------------------------------------------------------------- /TS_NodeJS/DinnerGuests/dinnerGuests.js: -------------------------------------------------------------------------------- 1 | var specialGuests = ["Sir Daniyal Nagori", "Sir Zia Khan", "Sir Muhammad Qasim"]; 2 | function inviteMessages(forGuest) { 3 | forGuest.forEach(function (forGuest) { 4 | var specialMessage = "\nAssalam-o-Alaikum\nDear ".concat(forGuest, ",\n\nI'm writing to extend a warm invitation to you for a dinner gathering at my place.\n\nIt would be an honor to have you join us for an evening filled with delightful conversation and delicious food.\nYour presence would greatly enrich our gathering.\n\nPlease let me know if you are coming to attend.\n\nWarm regards,\nMuhammad Salman Hussain\n\n"); 5 | console.log(specialMessage); 6 | }); 7 | } 8 | console.log("\nOLD MESSAGES:\n"); 9 | inviteMessages(specialGuests); 10 | var notComingGuest = specialGuests[0]; 11 | console.log("\nUnfortunately ".concat(notComingGuest, " can't come for the dinner.")); 12 | specialGuests.shift(); 13 | var newGuest = "ABC/XYZ"; /* Replacing Sir Daniyal Nagori's name with "ABC-XYZ" (None) */ 14 | specialGuests[0] = newGuest; 15 | console.log("NEW MESSAGES:\n"); 16 | inviteMessages(specialGuests); 17 | console.log("\nI found a bigger dinner table.\n"); 18 | specialGuests.unshift("ABC-123"); 19 | specialGuests.splice(Math.floor(specialGuests.length / 2), 0, "DEF-456"); 20 | specialGuests.push("GHI-789"); 21 | console.log("\nUPDATED GUEST LIST AND INVITATION MESSAGES:\n"); 22 | inviteMessages(specialGuests); 23 | console.log("\nNumber of people invited to dinner: ", specialGuests.length); 24 | -------------------------------------------------------------------------------- /TS_NodeJS/SeeingTheWorld/seeingTheWorld.js: -------------------------------------------------------------------------------- 1 | var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { 2 | if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 3 | if (ar || !(i in from)) { 4 | if (!ar) ar = Array.prototype.slice.call(from, 0, i); 5 | ar[i] = from[i]; 6 | } 7 | } 8 | return to.concat(ar || Array.prototype.slice.call(from)); 9 | }; 10 | var inNext5Years = ["UAE", "Qatar", "Australia", "Finland", "USA"]; 11 | console.log("Original Style:"); 12 | console.log(inNext5Years); 13 | console.log("\nAlphabetical Style (without modification):"); 14 | console.log(__spreadArray([], inNext5Years, true).sort()); 15 | console.log("\nArray is still in its original style:"); 16 | console.log(inNext5Years); 17 | console.log("\nReverse alphabetical order (without modification):"); 18 | console.log(__spreadArray([], inNext5Years, true).sort().reverse()); 19 | console.log("\nArray is still in its original style:"); 20 | console.log(inNext5Years); 21 | inNext5Years.reverse(); 22 | console.log("\nReversed style:"); 23 | console.log(inNext5Years); 24 | inNext5Years.reverse(); 25 | console.log("\nBack to original style:"); 26 | console.log(inNext5Years); 27 | inNext5Years.sort(); 28 | console.log("\nSorted in alphabetical style:"); 29 | console.log(inNext5Years); 30 | inNext5Years.sort(function (a, b) { return b.localeCompare(a); }); 31 | console.log("\nSorted in reverse alphabetical style:"); 32 | console.log(inNext5Years); 33 | -------------------------------------------------------------------------------- /TS_NodeJS/ChangingGuestList/changingGuestList.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | I'm Muhammad Salman Hussain, 4 | and all of the codes in TS_NodeJS folder is 100% my own struggle :`) 5 | 6 | */ 7 | var specialGuests = ["Sir Daniyal Nagori", "Sir Zia Khan", "Sir Muhammad Qasim"]; 8 | function inviteMessages(forGuest) { 9 | forGuest.forEach(function (forGuest) { 10 | /* The above code is for modifying my old message for new guest list */ 11 | var specialMessage = "\nAssalam-o-Alaikum\n Dear ".concat(forGuest, ",\n\n I'm writing to extand a warm invitation to you for a dinner gathering at my place.\n\n It would be an honor to have you join us for an evening filed with delightful conversation and delicious food.\n Your presence would greatly enrich our gathering.\n\n Please let me know if you are coming to attend.\n\n Warm regards,\n Muhammad Salman Hussain\n\n "); 12 | console.log(specialMessage); 13 | /* Then I paste my old message with console.log from my previous guestList.ts file */ 14 | /* And after this, just change ${guest} to ${forGuest} */ 15 | }); 16 | } 17 | ; 18 | console.log("\nOLD MESSAGES:\n"); 19 | inviteMessages(specialGuests); 20 | var notComingGuests = specialGuests[0]; 21 | console.log("\nUnfortunately ".concat(notComingGuests, " can't coming for the dinner.")); 22 | var newGuest = "ABC/XYZ"; /* Replacing Sir Daniyal Nagori's name with "ABC/XYZ" (None) */ 23 | specialGuests[0] = newGuest; 24 | console.log("NEW MESSAGES:\n"); 25 | inviteMessages(specialGuests); 26 | -------------------------------------------------------------------------------- /TS_NodeJS/UnchangedMagicians/unchangedMagicians.ts: -------------------------------------------------------------------------------- 1 | function makeGreatMagicians 2 | ( 3 | magicians: string[] 4 | ): 5 | string[] 6 | { 7 | const greatMagicians: string[] = []; 8 | 9 | for ( 10 | const magician of magicians 11 | ) 12 | 13 | { 14 | greatMagicians.push 15 | (`the Great ${magician}`); 16 | } 17 | 18 | return greatMagicians; 19 | } 20 | 21 | 22 | function showMagicians 23 | ( 24 | magicians: string[] 25 | ): 26 | string[] 27 | { 28 | const displayedMagicians: string[] = []; 29 | 30 | for ( 31 | const magician of magicians){ 32 | 33 | displayedMagicians.push(magician); 34 | 35 | console.log(magician); 36 | } 37 | 38 | return displayedMagicians; 39 | } 40 | 41 | 42 | const magicians: string[] = 43 | [ 44 | "Jeff McBride (American Magician)", 45 | "Penn & Teller (American Magicians)", 46 | "Criss Angel (American Magicians)" 47 | ]; 48 | 49 | const copiedMagicians: string[] 50 | = magicians.slice(); 51 | 52 | const greatMagicians: string[] 53 | = makeGreatMagicians(copiedMagicians); 54 | 55 | console.log("Original Magicians:"); 56 | const originalMagicians: string[] 57 | = showMagicians(magicians); 58 | 59 | console.log("\nGreat Magicians:"); 60 | const modifiedMagicians: string[] 61 | = showMagicians(greatMagicians); 62 | 63 | console.log(originalMagicians); 64 | console.log(modifiedMagicians); -------------------------------------------------------------------------------- /TS_NodeJS/DinnerGuests/dinnerGuests.ts: -------------------------------------------------------------------------------- 1 | const specialGuests: string[] = ["Sir Daniyal Nagori", "Sir Zia Khan", "Sir Muhammad Qasim"]; 2 | 3 | function inviteMessages(forGuest: string[]) 4 | { 5 | forGuest.forEach 6 | (forGuest => 7 | { 8 | const specialMessage: string = ` 9 | Assalam-o-Alaikum 10 | Dear ${forGuest}, 11 | 12 | I'm writing to extend a warm invitation to you for a dinner gathering at my place. 13 | 14 | It would be an honor to have you join us for an evening filled with delightful conversation and delicious food. 15 | Your presence would greatly enrich our gathering. 16 | 17 | Please let me know if you are coming to attend. 18 | 19 | Warm regards, 20 | Muhammad Salman Hussain\n 21 | `; 22 | console.log(specialMessage); 23 | } 24 | 25 | ); 26 | } 27 | 28 | console.log("\nOLD MESSAGES:\n"); 29 | inviteMessages(specialGuests); 30 | 31 | const notComingGuest: string = specialGuests[0]; 32 | console.log(`\nUnfortunately ${notComingGuest} can't come for the dinner.`); 33 | specialGuests.shift(); 34 | 35 | const newGuest: string = "ABC/XYZ"; /* Replacing Sir Daniyal Nagori's name with "ABC-XYZ" (None) */ 36 | 37 | specialGuests[0] = newGuest; 38 | 39 | console.log("NEW MESSAGES:\n"); 40 | inviteMessages(specialGuests); 41 | 42 | console.log("\nI found a bigger dinner table.\n"); 43 | 44 | specialGuests.unshift("ABC-123"); 45 | specialGuests.splice( 46 | Math.floor(specialGuests.length / 2), 0, "DEF-456" 47 | ); 48 | specialGuests.push("GHI-789"); 49 | 50 | console.log("\nUPDATED GUEST LIST AND INVITATION MESSAGES:\n"); 51 | 52 | inviteMessages(specialGuests); 53 | 54 | console.log("\nNumber of people invited to dinner: ", specialGuests.length); -------------------------------------------------------------------------------- /TS_NodeJS/ChangingGuestList/changingGuestList.ts: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | I'm Muhammad Salman Hussain, 4 | and all of the codes in TS_NodeJS folder is 100% my own struggle :`) 5 | 6 | */ 7 | 8 | const specialGuests : string[] = ["Sir Daniyal Nagori" , "Sir Zia Khan" , "Sir Muhammad Qasim"]; 9 | 10 | function inviteMessages(forGuest : string[]) { 11 | forGuest.forEach( 12 | forGuest => { 13 | 14 | /* The above code is for modifying my old message for new guest list */ 15 | 16 | const specialMessage : string = 17 | `\nAssalam-o-Alaikum 18 | Dear ${forGuest}, 19 | 20 | I'm writing to extand a warm invitation to you for a dinner gathering at my place. 21 | 22 | It would be an honor to have you join us for an evening filed with delightful conversation and delicious food. 23 | Your presence would greatly enrich our gathering. 24 | 25 | Please let me know if you are coming to attend. 26 | 27 | Warm regards, 28 | Muhammad Salman Hussain\n 29 | ` 30 | console.log(specialMessage); 31 | 32 | /* Then I paste my old message with console.log from my previous guestList.ts file */ 33 | /* And after this, just change ${guest} to ${forGuest} */ 34 | } 35 | ) 36 | }; 37 | 38 | console.log("\nOLD MESSAGES:\n"); 39 | inviteMessages(specialGuests); 40 | 41 | const notComingGuests : string = specialGuests[0]; 42 | console.log(`\nUnfortunately ${notComingGuests} can't coming for the dinner.`); 43 | 44 | const newGuest : string = "ABC/XYZ"; /* Replacing Sir Daniyal Nagori's name with "ABC/XYZ" (None) */ 45 | specialGuests[0] = newGuest 46 | 47 | console.log("NEW MESSAGES:\n"); 48 | inviteMessages(specialGuests); -------------------------------------------------------------------------------- /TS_NodeJS/ConditionalTests/conditionalTests.ts: -------------------------------------------------------------------------------- 1 | let car = 'subaru'; 2 | 3 | /* CarTest 1 */ 4 | 5 | console.log( 6 | "Is car equal to 'subaru'? Result:", 7 | car == 'subar' 8 | ); 9 | 10 | /* CarTest 2 */ 11 | 12 | console.log( 13 | "Is car not equal to 'toyota'? Result:", 14 | car != 'subaru' 15 | ); 16 | 17 | /* CarTest 3 */ 18 | 19 | console.log( 20 | "Is car equal to 'Subaru' (case-sensitive)? Result:", 21 | car === 'Subaru' 22 | ); 23 | 24 | /* CarTest 4 */ 25 | 26 | console.log( 27 | "Is car equal to 'subaru' (case-insensitive)? Result:", 28 | car.toLowerCase() === 'suBaru' 29 | ); 30 | 31 | /* CarTest 5 */ 32 | 33 | console.log( 34 | "Is car greater than 'BMW' (alphabetical order)? Result:", 35 | car > 'BMW' 36 | ); 37 | 38 | /* CarTest 6 */ 39 | 40 | console.log( 41 | "Is car less than or equal to 'Mercedes-Benz' (alphabetical order)? Result:", 42 | car <= 'REVO' 43 | ); 44 | 45 | /* CarTest 7 */ 46 | 47 | console.log( 48 | "Does car start with 'sub'? Result:", 49 | car.startsWith('sub') 50 | ); 51 | 52 | /* CarTest 8 */ 53 | 54 | console.log( 55 | "Does car end with 'aru'? Result:", 56 | car.endsWith('aru') 57 | ); 58 | 59 | /* CarTest 9 */ 60 | 61 | console.log( 62 | "Is the length of car equal to 6? Result:", 63 | car.length === 6 64 | ); 65 | 66 | /* CarTest 10 */ 67 | 68 | console.log( 69 | "Does car contain the letter 'u'? Result:", 70 | car.includes('u') 71 | ); 72 | /* 73 | 10 Tests Completed 74 | */ -------------------------------------------------------------------------------- /TS_NodeJS/MoreGuest/MoreGuest.js: -------------------------------------------------------------------------------- 1 | var specialGuests = ["Sir Daniyal Nagori", "Sir Zia Khan", "Sir Muhammad Qasim"]; 2 | function inviteMessages(forGuest) { 3 | forGuest.forEach(function (forGuest) { 4 | /* The above code is for modifying my old message for new guest list */ 5 | var specialMessage = "\nAssalam-o-Alaikum\nDear ".concat(forGuest, ",\n\nI'm writing to extend a warm invitation to you for a dinner gathering at my place.\n\nIt would be an honor to have you join us for an evening filled with delightful conversation and delicious food.\nYour presence would greatly enrich our gathering.\n\nPlease let me know if you are coming to attend.\n\nWarm regards,\nMuhammad Salman Hussain\n\n"); 6 | console.log(specialMessage); 7 | /* Then I paste my old message with console.log from my previous guestList.ts file */ 8 | /* And after this, just change ${guest} to ${forGuest} */ 9 | }); 10 | } 11 | ; 12 | console.log("\nOLD MESSAGES:\n"); 13 | inviteMessages(specialGuests); 14 | var notComingGuests = specialGuests[0]; 15 | console.log("\nUnfortunately ".concat(notComingGuests, " can't come for the dinner.")); 16 | var newGuest = "ABC/XYZ"; /* Replacing Sir Daniyal Nagori's name with "ABC-XYZ" (None) */ 17 | specialGuests[0] = newGuest; 18 | console.log("NEW MESSAGES:\n"); 19 | inviteMessages(specialGuests); 20 | /* 21 | **** DONE with the Help of W3School **** 22 | 23 | Now adding more guests... 24 | "ABC-123" , "DEF-456" , "GHI-789" are 3 new guests names, using just for example. 25 | */ 26 | console.log("\nI found a bigger dinner table.\n"); 27 | /* 28 | Using "unshift() and splice()" from the help of W3School! 29 | */ 30 | specialGuests.unshift("ABC-123"); 31 | specialGuests.splice( 32 | /* Here I'm using Math.floor */ 33 | Math.floor(specialGuests.length / 2), 0, "DEF-456"); 34 | /* 35 | Using "push()" from the help of W3School! 36 | */ 37 | specialGuests.push("GHI-789"); 38 | console.log("\nUPDATED GUEST LIST AND INVITATION MESSAGES:\n"); 39 | inviteMessages(specialGuests); 40 | /* 41 | Using "unshift(), splice(), and push()" from the help of W3School 42 | */ 43 | -------------------------------------------------------------------------------- /TS_NodeJS/ShrinkingGuestList/shrinkingGuestList.js: -------------------------------------------------------------------------------- 1 | var specialGuests = ["Sir Daniyal Nagori", "Sir Zia Khan", "Sir Muhammad Qasim"]; 2 | function inviteMessages(forGuest) { 3 | forGuest.forEach(function (forGuest) { 4 | var specialMessage = "\nAssalam-o-Alaikum\nDear ".concat(forGuest, ",\n\nI'm writing to extend a warm invitation to you for a dinner gathering at my place.\n\nIt would be an honor to have you join us for an evening filled with delightful conversation and delicious food.\nYour presence would greatly enrich our gathering.\n\nPlease let me know if you are coming to attend.\n\nWarm regards,\nMuhammad Salman Hussain\n\n"); 5 | console.log(specialMessage); 6 | }); 7 | } 8 | console.log("\nOLD MESSAGES:\n"); 9 | inviteMessages(specialGuests); 10 | var notComingGuest = specialGuests[0]; 11 | console.log("\nUnfortunately ".concat(notComingGuest, " can't come for the dinner.")); 12 | specialGuests.shift(); 13 | /* Removing first guest */ 14 | var newGuest = "ABC/XYZ"; /* Replacing Sir Daniyal Nagori's name with "ABC-XYZ" (None) */ 15 | specialGuests[0] = newGuest; 16 | console.log("NEW MESSAGES:\n"); 17 | inviteMessages(specialGuests); 18 | console.log("\nI found a bigger dinner table.\n"); 19 | specialGuests.unshift("ABC-123"); 20 | specialGuests.splice(Math.floor(specialGuests.length / 2), 0, "DEF-456"); 21 | specialGuests.push("GHI-789"); 22 | /* DONE with the Help of W3School - Salman */ 23 | console.log("\nUPDATED GUEST LIST AND INVITATION MESSAGES:\n"); 24 | inviteMessages(specialGuests); 25 | /* DONE with the Help of W3School - Salman */ 26 | console.log("\nI can only invite two people for dinner.\n"); 27 | while (specialGuests.length > 2) { 28 | var removedGuest = specialGuests.pop(); 29 | console.log("Sorry, ".concat(removedGuest, ", I can't invite you to dinner.")); 30 | } 31 | console.log("\nInvitations for the two remaining guests:\n"); 32 | inviteMessages(specialGuests); 33 | specialGuests.pop(); 34 | specialGuests.pop(); 35 | console.log("\nThank you\t", specialGuests); 36 | /* Some Code of this Script is done with help of W3School 37 | Muhammad Salman Hussain | Timings: THUR - 7:00 to 10:00 PM 38 | */ 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | *** SPECIAL MESSAGE *** 2 | 3 | To whom it may concern, 4 | 5 | Assalam-o-Alaikum, 6 | 7 | Dear Teacher & Faculty of our "Certified Cloud Applied Generative AI Engineering" Course, 8 | in The Governor House, Karachi. 9 | 10 | I began working on this assignment on Saturday, February 17, 2024, at 6:20:13 PM, 11 | and completed the first Four (4) questions on the same day. 12 | The following day, Sunday, February 18, 2024, I completed Seven (7) more questions. 13 | Then, on Monday, February 19, 2024, I completed Eight (8) additional questions. 14 | Despite the demands of daily life, 15 | I solved all the remaining 24 questions on Tuesday, February 20, 2024, at 6:46:45 PM. 16 | 17 | ________________________________________________________________________________________________ 18 | To verify this, 19 | please download the folder "TS_NodeJS" from my GitHub, then sort the files by date modified. 20 | ________________________________________________________________________________________________ 21 | 22 | For this TypeScript assignment, 23 | I exerted 90% of my own efforts and knowledge in TypeScript programming. 24 | For the remaining 10%, 25 | I sought assistance from W3Schools for 5% of the solutions, 26 | more, I utilized information from other websites for the remaining 5%. 27 | 28 | My name is Muhammad Salman Hussain, 29 | and I hold 17 Skills Badges from the Google Cloud Career Path, 30 | with a total score of 7615 Points, placing me in the Gold League. 31 | I'm an award-winning Frontend Developer since 2020/21, 32 | and possess expertise in Digital Marketing, WordPress, and more. 33 | 34 | Roll #: 00319106 35 | Class Timings: Thursday - 7 to 10 PM (On-site)* 36 | LinkedIn: in/mshsheikh 37 | 38 | I'm excited and interested in learning AI, Cryptography, Blockchain Technology, and many other fields. 39 | 40 | I extend my gratitude to all our teachers, faculty, and management, 41 | for their support throughout this course at Governor House. 42 | 43 | Special Thanks to; 44 | Governor Sindh, Sir Kamran Khan Tessori 45 | Sir Zia, Sir Daniyal Nagori, Sir Muhammad Qasim, and the entire team. 46 | 47 | Thank you. 48 | 49 | Sincerely, 50 | Muhammad Salman Hussain 51 | 52 | SAY NO TO "Plagiarism" :) 53 | -------------------------------------------------------------------------------- /TS_NodeJS/README.txt: -------------------------------------------------------------------------------- 1 | *** SPECIAL MESSAGE *** 2 | To whom it may concern, 3 | 4 | Assalam-o-Alaikum, 5 | 6 | Dear Teacher & Faculty of our "Certified Cloud Applied Generative AI Engineering" Course, 7 | in The Governor House, Karachi. 8 | 9 | I began working on this assignment on Saturday, February 17, 2024, at 6:20:13 PM, 10 | and completed the first Four (4) questions on the same day. 11 | The following day, Sunday, February 18, 2024, I completed Seven (7) more questions. 12 | Then, on Monday, February 19, 2024, I completed Eight (8) additional questions. 13 | Despite the demands of daily life, 14 | I solved all the remaining 24 questions on Tuesday, February 20, 2024, at 6:46:45 PM. 15 | 16 | ________________________________________________________________________________________________ 17 | To verify this, 18 | please download the folder "TS_NodeJS" from my GitHub, then sort the files by date modified. 19 | ________________________________________________________________________________________________ 20 | 21 | For this TypeScript assignment, 22 | I exerted 90% of my own efforts and knowledge in TypeScript programming. 23 | For the remaining 10%, 24 | I sought assistance from W3Schools for 5% of the solutions, 25 | more, I utilized information from other websites for the remaining 5%. 26 | 27 | My name is Muhammad Salman Hussain, 28 | and I hold 17 Skills Badges from the Google Cloud Career Path, 29 | with a total score of 7615 Points, placing me in the Gold League. 30 | I'm an award-winning Frontend Developer since 2020/21, 31 | and possess expertise in Digital Marketing, WordPress, and more. 32 | 33 | Roll #: 00319106 34 | Class Timings: Thursday - 7 to 10 PM (On-site)* 35 | LinkedIn: in/mshsheikh 36 | 37 | I'm excited and interested in learning AI, Cryptography, Blockchain Technology, and many other fields. 38 | 39 | I extend my gratitude to all our teachers, faculty, and management, 40 | for their support throughout this course at Governor House. 41 | 42 | Special Thanks to; 43 | Governor Sindh, Sir Kamran Khan Tessori 44 | Sir Zia, Sir Daniyal Nagori, Sir Muhammad Qasim, and the entire team. 45 | 46 | Thank you. 47 | 48 | Sincerely, 49 | Muhammad Salman Hussain 50 | SAY NO TO "Plagiarism" :) -------------------------------------------------------------------------------- /TS_NodeJS/MoreGuest/moreGuest.ts: -------------------------------------------------------------------------------- 1 | const specialGuests: string[] = ["Sir Daniyal Nagori", "Sir Zia Khan", "Sir Muhammad Qasim"]; 2 | 3 | function inviteMessages(forGuest: string[]) { 4 | forGuest.forEach(forGuest => { 5 | 6 | /* The above code is for modifying my old message for new guest list */ 7 | const specialMessage: string = ` 8 | Assalam-o-Alaikum 9 | Dear ${forGuest}, 10 | 11 | I'm writing to extend a warm invitation to you for a dinner gathering at my place. 12 | 13 | It would be an honor to have you join us for an evening filled with delightful conversation and delicious food. 14 | Your presence would greatly enrich our gathering. 15 | 16 | Please let me know if you are coming to attend. 17 | 18 | Warm regards, 19 | Muhammad Salman Hussain\n 20 | `; 21 | console.log(specialMessage); 22 | 23 | /* Then I paste my old message with console.log from my previous guestList.ts file */ 24 | /* And after this, just change ${guest} to ${forGuest} */ 25 | }); 26 | }; 27 | 28 | console.log("\nOLD MESSAGES:\n"); 29 | inviteMessages(specialGuests); 30 | 31 | const notComingGuests: string = specialGuests[0]; 32 | console.log(`\nUnfortunately ${notComingGuests} can't come for the dinner.`); 33 | 34 | const newGuest: string = "ABC/XYZ"; /* Replacing Sir Daniyal Nagori's name with "ABC-XYZ" (None) */ 35 | specialGuests[0] = newGuest; 36 | 37 | console.log("NEW MESSAGES:\n"); 38 | inviteMessages(specialGuests); 39 | 40 | 41 | /* 42 | **** DONE with the Help of W3School **** 43 | 44 | Now adding more guests... 45 | "ABC-123" , "DEF-456" , "GHI-789" are 3 new guests names, using just for example. 46 | */ 47 | 48 | console.log("\nI found a bigger dinner table.\n"); 49 | 50 | /* 51 | Using "unshift() and splice()" from the help of W3School! 52 | */ 53 | 54 | specialGuests.unshift("ABC-123"); 55 | specialGuests.splice( 56 | 57 | /* Here I'm using Math.floor */ 58 | 59 | Math.floor(specialGuests.length / 2), 0, "DEF-456"); 60 | 61 | /* 62 | Using "push()" from the help of W3School! 63 | */ 64 | 65 | specialGuests.push("GHI-789"); 66 | 67 | console.log("\nUPDATED GUEST LIST AND INVITATION MESSAGES:\n"); 68 | inviteMessages(specialGuests); 69 | 70 | /* 71 | Using "unshift(), splice(), and push()" from the help of W3School 72 | */ -------------------------------------------------------------------------------- /TS_NodeJS/ShrinkingGuestList/shrinkingGuestList.ts: -------------------------------------------------------------------------------- 1 | const specialGuests: string[] = ["Sir Daniyal Nagori", "Sir Zia Khan", "Sir Muhammad Qasim"]; 2 | 3 | function inviteMessages( 4 | forGuest: string[] 5 | ) 6 | { 7 | forGuest.forEach(forGuest => 8 | 9 | { 10 | const specialMessage: string = ` 11 | Assalam-o-Alaikum 12 | Dear ${forGuest}, 13 | 14 | I'm writing to extend a warm invitation to you for a dinner gathering at my place. 15 | 16 | It would be an honor to have you join us for an evening filled with delightful conversation and delicious food. 17 | Your presence would greatly enrich our gathering. 18 | 19 | Please let me know if you are coming to attend. 20 | 21 | Warm regards, 22 | Muhammad Salman Hussain\n 23 | `; 24 | console.log(specialMessage); 25 | } 26 | ); 27 | } 28 | 29 | console.log("\nOLD MESSAGES:\n"); 30 | inviteMessages(specialGuests); 31 | 32 | const notComingGuest: string = specialGuests[0]; 33 | console.log(`\nUnfortunately ${notComingGuest} can't come for the dinner.`); 34 | specialGuests.shift(); 35 | /* Removing first guest */ 36 | 37 | const newGuest: string = "ABC/XYZ"; /* Replacing Sir Daniyal Nagori's name with "ABC-XYZ" (None) */ 38 | specialGuests[0] = newGuest; 39 | 40 | console.log("NEW MESSAGES:\n"); 41 | inviteMessages(specialGuests); 42 | 43 | console.log("\nI found a bigger dinner table.\n"); 44 | 45 | specialGuests.unshift("ABC-123"); 46 | specialGuests.splice( 47 | Math.floor(specialGuests.length / 2), 0, "DEF-456" 48 | ); 49 | 50 | specialGuests.push("GHI-789"); 51 | 52 | /* DONE with the Help of W3School - Salman */ 53 | 54 | console.log("\nUPDATED GUEST LIST AND INVITATION MESSAGES:\n"); 55 | inviteMessages(specialGuests); 56 | 57 | /* DONE with the Help of W3School - Salman */ 58 | 59 | console.log("\nI can only invite two people for dinner.\n"); 60 | 61 | while (specialGuests.length > 2) { 62 | const removedGuest: string = specialGuests.pop()!; 63 | console.log(`Sorry, ${removedGuest}, I can't invite you to dinner.`); 64 | } 65 | 66 | console.log("\nInvitations for the two remaining guests:\n"); 67 | inviteMessages(specialGuests); 68 | 69 | specialGuests.pop(); 70 | specialGuests.pop(); 71 | 72 | console.log("\nThank you\t", specialGuests); 73 | 74 | /* Some Code of this Script is done with help of W3School 75 | Muhammad Salman Hussain | Timings: THUR - 7:00 to 10:00 PM 76 | */ --------------------------------------------------------------------------------