Welcome to my repository! Here you will find solutions to a wide range of TypeScript and Node.js exercises. These exercises were designed to help beginners like myself get hands-on experience with basic programming concepts, all while having fun! π
- π Installation
- π Exercises Overview
- π€ Personal Message
- π‘ Name Cases
- π Famous Quote
- π§Ό Stripping Names
- β Number Eight
- π Favorite Number
- π₯ Names Array
- π¬ Greetings
- π½οΈ Guest List
- π More Guests
- π Shrinking Guest List
- π Seeing the World
- πΎ Alien Colors
- π Stages of Life
- π Favorite Fruit
- π¨βπ» Hello Admin
- π Checking Usernames
- π T-Shirt Function
- ποΈ Cities Function
- π§ββοΈ Magicians
- π₯ͺ Sandwiches
- π Cars Object
- π License
Before you can dive into the exercises, make sure you have Node.js, TypeScript, and a code editor like VS Code installed on your system. Follow these simple steps to get started:
- Install Node.js from here π₯οΈ.
- Install TypeScript globally:
npm install -g typescript
- Clone this repository:
git clone <your-repo-url> cd <your-repo-folder>
- Install Dependencies:
Each exercise is independent, and if needed, runnpm init
inside the folder. - Run the exercises:
Compile TypeScript files:Then run them using Node.js:tsc filename.ts
node filename.js
This simple exercise stores a personβs name in a variable and prints a greeting message. Example:
let name = "Eric";
console.log(`Hello ${name}, would you like to learn some TypeScript today?`);
You can view the complete solution here.
This program displays a name in lowercase, uppercase, and titlecase.You can view the complete solution here.
Prints a famous quote with the author's name, demonstrating the use of string formatting.You can view the complete solution here,here.
Trims leading and trailing whitespace from a string.You can view the complete solution here,here
Performs arithmetic operations (addition, subtraction, multiplication, and division) to get the result 8
.You can view the complete solution here,here
Stores and displays a favorite number with a personalized message.You can view the complete solution here
Stores a list of names and prints each name from the array. You can view the complete solution here
Personalized greetings for each name stored in an array.You can view the complete solution here
Creates a list of guests and sends them dinner invitations.You can view the complete solution here,here
Expands the guest list to invite more people and prints updated invitations.You can view the complete solution here
Shrinks the guest list by removing guests one by one and sending them apology messages.You can view the complete solution here
Stores a list of favorite places and prints them in various orders (original, alphabetical, reverse).You can view the complete solution here
A conditional program that prints a message based on the alienβs color.You can view the complete solution here,here,here
Uses if-else
logic to determine a personβs stage of life based on their age.You can view the complete solution here,
Checks if certain fruits are in an array and prints a personalized message for each.You can view the complete solution here.
Prints a greeting for users, with a special message for the admin.You can view the complete solution here,here,
Simulates checking if new usernames are available, comparing them to existing ones.You can view the complete solution here,
A function that accepts a shirt size and message, printing out the details of the shirt.You can view the complete solution here, here
A function that describes a city and its country, with a default country parameter.You can view the complete solution here,here
A function that prints magician names from an array, and modifies the array to prepend "The Great" to each name.You can view the complete solution here,
A function that prints a summary of a sandwich order, with varying ingredients.You can view the complete solution here,
A function that stores information about a car in an object and accepts arbitrary keyword arguments.You can view the complete solution here
This repository is open-source and licensed under the MIT License. Feel free to explore, learn, and contribute!