Coding Challenges
Day 1
Question 1
Install Node.js, TypeScript and VS Code on your setup.
Question 2
Personal Message: Store a person’s name in a variable, and print a message to that person. Your message should be simple, such as, “Hello Eric, would you like to learn some Python today?”
Question 3
Name Cases: Store a person’s name in a variable, and then print that person’s name in lowercase, uppercase, and titlecase.
Day 2
Question 4
Famous Quote: Find a quote from a famous person you admire. Print the quote and the name of its author. Your output should look something like the following, including the quotation marks: Albert Einstein once said, “A person who never made a mistake never tried anything new.”
Question 5
Famous Quote 2: Repeat Exercise 4, but this time store the famous person’s name in a variable called famous_person. Then compose your message and store it in a new variable called message. Print your message.
Question 6
Stripping Names: Store a person’s name, and include some whitespace characters at the beginning and end of the name. Make sure you use each character combination, " " and " ", at least once. Print the name once, so the whitespace around the name is displayed. Then print the name after striping the white spaces.
Day 3
Question 7
Number Eight: Write addition, subtraction, multiplication, and division operations that each result in the number 8. Be sure to enclose your operations in print statements to see the results.
Question 8
You should create four lines that look like this: console.log(5 + 3) Your output should simply be four lines with the number 8 appearing once on each line.
Question 9
Favorite Number: Store your favorite number in a variable. Then, using that variable, create a message that reveals your favorite number. Print that message.
Day 4
Question 10
Adding Comments: Choose two of the programs you’ve written, and add at least one comment to each. If you don’t have anything specific to write because your programs are too simple at this point, just add your name and the current date at the top of each program file. Then write one sentence describing what the program does.
Question 11
Names: Store the names of a few of your friends in a array called names. Print each person’s name by accessing each element in the list, one at a time.
Question 12
Greetings: Start with the array you used in Exercise 11, but instead of just printing each person’s name, print a message to them. The text of each message should be the same, but each message should be personalized with the person’s name.
Day 5
Question 13
Your Own Array: Think of your favorite mode of transportation, such as a motorcycle or a car, and make a list that stores several examples. Use your list to print a series of statements about these items, such as “I would like to own a Honda motorcycle.”
Question 14
Guest List: If you could invite anyone, living or deceased, to dinner, who would you invite? Make a list that includes at least three people you’d like to invite to dinner. Then use your list to print a message to each person, inviting them to dinner.
Question 15
Changing Guest List: You just heard that one of your guests can’t make the dinner, so you need to send out a new set of invitations. You’ll have to think of someone else to invite, full-question
Day 6
Question 16
More Guests: You just found a bigger dinner table, so now more space is available. Think of three more guests to invite to dinner, full-question
Question 17
Shrinking Guest List: You just found out that your new dinner table won’t arrive in time for the dinner, and you have space for only two guests, full-question
Question 18
Seeing the World: Think of at least five places in the world you’d like to visit. - Store the locations in a array. Make sure the array is not in alphabetical order, full-question
Day 7
Question 19
Dinner Guests: Working with one of the programs from Exercises 14 through 18, print a message indicating the number of people you are inviting to dinner.
Question 20
Think of something you could store in a array. For example, you could make a list of mountains, rivers, countries, cities, languages, or anything else you’d like. Write a program that creates a list containing these items.
Question 21
They think of something you could store in a TypeScript Object. Write a program that creates Objects containing these items.
Day 8
Question 22
Intentional Error: If you haven’t received an array index error in one of your programs yet, try to make one happen. Change an index in one of your programs to produce an index error. Make sure you correct the error before closing the program.
Question 23
Conditional Tests: Write a series of conditional tests. Print a statement describing each test and your prediction for the results of each test. Your code should look something like this, full-question
Question 24
More Conditional Tests: You don’t have to limit the number of tests you create to 10. If you want to try more comparisons, write more tests. Have at least one True and one False result for each of the following, full-question
Day 9
Question 25
Alien Colors #1: Imagine an alien was just shot down in a game. Create a variable called alien_color and assign it a value of green, yellow, or red. full-question
Question 26
Alien Colors #2: Choose a color for an alien as you did in Exercise 25, and write an if-else chain. full-question
Question 27
Alien Colors #3: Turn your if-else chain from Exercise 5-4 into an if-else chain. - If the alien is green, print a message that the player earned 5 points, full-question
Day 10
Question 28
Stages of Life: Write an if-else chain that determines a person’s stage of life. Set a value for the variable age, and then, full-question
Question 29
Favorite Fruit: Make a array of your favorite fruits, and then write a series of independent if statements that check for certain fruits in your array. full-question
Question 30
Hello Admin: Make a array of five or more usernames, including the name admin. Imagine you are writing code that will print a greeting to each user after they log in to a website. Loop through the array, and print a greeting to each user, full-question
Day 11
Question 31
No Users: Add an if test to Exercise 28 to make sure the list of users is not empty. - If the list is empty, print the message We need to find some users! full-question
Question 32
Checking Usernames: Do the following to create a program that simulates how websites ensure that everyone has a unique username. - Make a list of five or more usernames called current_users. full-question
Question 33
Ordinal Numbers: Ordinal numbers indicate their position in a array, such as 1st or 2nd. Most ordinal numbers end in th, except 1, 2, and 3. full-question
Day 12
Question 34
Pizzas: Think of at least three kinds of your favorite pizza. Store these pizza names in a array, and then use a for loop to print the name of each pizza. full-question
Question 35
Animals: Think of at least three different animals that have a common characteristic. Store the names of these animals in a list, and then use a for loop to print out the name of each animal. full-question
Question 36
T-Shirt: Write a function called make_shirt() that accepts a size and the text of a message that should be printed on the shirt. The function should print a sentence summarizing the size of the shirt and the message printed on it. Call the function.
Day 13
Question 37
Large Shirts: Modify the make_shirt() function so that shirts are large by default with a message that reads I love TypeScript. Make a large shirt and a medium shirt with the default message, and a shirt of any size with a different message.
Question 38
Cities: Write a function called describe_city() that accepts the name of a city and its country. The function should print a simple sentence, such as Karachi is in Pakistan. Give the parameter for the country a default value. Call your function for three different cities, at least one of which is not in the default country.
Question 39
City Names: Write a function called city_country() that takes in the name of a city and its country. The function should return a string formatted like this full-question
Day 14
Question 40
Album: Write a function called make_album() that builds a Object describing a music album. The function should take in an artist name and an album title, and it should return a Object containing these two pieces of information. Use the function to make three dictionaries representing different albums. Print each return value to show that Objects are storing the album information correctly. full-question
Question 41
Magicians: Make a array of magician’s names. Pass the array to a function called show_magicians(), which prints the name of each magician in the array.
Question 42
Great Magicians: Start with a copy of your program from Exercise 39. Write a function called make_great() that modifies the array of magicians by adding the phrase the Great to each magician’s name. Call show_magicians() to see that the list has actually been modified.
Day 15
Question 43
Unchanged Magicians: Start with your work from Exercise 40. Call the function make_great() with a copy of the array of magicians’ names. Because the original array will be unchanged, return the new array and store it in a separate array. Call show_magicians() with each array to show that you have one array of the original names and one array with the Great added to each magician’s name.
Question 44
Sandwiches: Write a function that accepts a array of items a person wants on a sandwich. The function should have one parameter that collects as many items as the function call provides, and it should print a summary of the sandwich that is being ordered. Call the function three times, using a different number of arguments each time.
Question 45
Cars: Write a function that stores information about a car in a Object. The function should always receive a manufacturer and a model name. It should then accept an arbitrary number of keyword arguments. Call the function with the required information and two other name-value pairs, such as a color or an optional feature. Print the Object that’s returned to make sure all the information was stored correctly.
Day 16
Question 46
Enhanced Laptop Object: Construct an object for a laptop including properties make, model, year, and a method describe() that logs a sentence about the laptop.
Question 47
Array Destructuring: Given an array of objects representing different laptops, each with properties `make`, `model`, and `year`, use array destructuring to assign the first and second laptops to variables. Then, log these variables.
Question 48
Combining Arrays with Spread Operator: Suppose you are comparing prices of two different sets of laptops. Use the spread operator to combine these arrays into a single array sorted in ascending order, then log the result.
Day 17
Question 49
Function with Rest Parameters: Write a function that takes a rest parameter representing multiple hobbies. It should log each hobby with a statement saying you enjoy that hobby.
Question 50
Multiline Template Literals: Use template literals to create a multiline string that describes your ideal day. Include at least three different activities.
Question 51
Refactoring to Arrow Functions: Take a simple function that calculates the area of a rectangle and refactor it into an arrow function.
Day 18
Question 52
Make a Smartphone Object: Create a simple way to keep track of a smartphones details. Include its brand, model, and other key features like how much storage it has, the size of its screen, and how long its battery lasts.
Question 53
Pulling Apart a Nested Object: Imagine you have a list inside another list that shows what a computer programmer knows, like coding languages, tools, and software frameworks. Find a way to get three specific skills from this list and show them.
Question 54
Making Flexible Object Keys: Learn how to set up a list where you can change the name of each section based on what you need at that moment, like adjusting labels based on user choices.
Day 19
Question 55
Double Numbers in an Array: Make a list of numbers. Then, use a trick to make a new list where each number is twice its original value.
Question 56
Keep Only Strings: Given a mix of different types of items, make a new list that has only the words.
Question 57
Find the Average Grade: Given a list of grades, calculate the average grade.
Day 20
Question 58
Write a simple program that can take lots of scores and find their average.
Question 59
Add a Special Number: Make a program that creates custom adders. These adders can add a specific number to any other number you give them later.
Question 60
Self-Running User Profile: Create a quick, self-setup profile for a user that can tell you the users name and age.
Day 21
Question 61
Making Enums for Vehicles: Lets create categories for vehicles like cars, trucks, and motorcycles using enums, and show one example.
Question 62
Making a Student Template: Create a blueprint for student information, including their name, age, and the classes they are taking, and then fill in this blueprint with an example student.
Question 63
Shape Shifter: Write a program that can describe either a circle or a rectangle using a special type alias, including properties unique to each shape.
Day 22
Question 64
Combine Strings and Numbers: Write a function that merges a piece of text with a number. For example, if provided with Age: and 30, it should give back Age: 30.
Question 65
Determine the Remainder: Make a function that gets two numbers and shows the leftover from dividing them using the `%` sign. For example, `remainder(5, 2)` should give `1`.
Question 66
Logical AND Verification: Create a function that checks two boolean (true or false) values. It should only say `true` if both are true, using the `&&` operator. For instance, `checkBothTrue(true, false)` should be `false`.
Day 23
Question 67
Arithmetic with Mixed Types: Write a function that takes two parameters: a number and a string that represents a number (e.g., `5`). Return their sum as a number.
Question 68
Multiplying Decimals: Create a function that accepts two decimal numbers and returns their product. Round the result to two decimal places.
Question 69
Dividing and Finding the Remainder: Write a function that divides two numbers and returns both the quotient and the remainder. Use an object to return both values.
Day 24
Question 70
Understanding let in Loops: Write a function that uses a loop with the let keyword to print numbers from 1 to 5. Explain how the let keyword affects the visibility of the loop variable.
Question 71
Compare `let` and `const`: Create two examples where `let` allows reassignment but `const` does not. Try to reassign a `const`-declared variable and catch the error.
Question 72
Block Scope with `let` and `const`: Demonstrate block scope by creating a code block with `` that uses both `let` and `const`. Show how variables declared inside the block are not accessible outside of it.
Day 25
Question 73
Assigning and Updating Variables: Create a function where you declare a variable using let and assign an initial value. Then, update its value within the same function and log both the initial and updated values.
Question 74
Swapping Variables: Demonstrate how to swap the values of two variables. Start with variables `a = 5` and `b = 10`, then swap their values so that `a` becomes `10` and `b` becomes `5`.
Question 75
Compound Assignment Operators: Use compound assignment operators to simplify arithmetic operations. Start with `x = 4` and perform a series of operations (addition, subtraction, multiplication, division) on `x` using compound operators.
Day 26
Question 76
Function Parameters and Return Values: Create a function that takes two numbers as parameters, adds them together, and returns the result. Show how you can call this function and log the result.
Question 77
Default Parameters: Write a function that greets a user. It should take the users name as a parameter and say hello. If no name is given, it should greet an anonymous user.
Question 78
Function Expressions vs. Function Declarations: Compare function expressions and declarations by creating one of each that performs the same task, such as squaring a number.
Day 27
Question 79
Creating and Accessing Object Properties: Construct an object representing a car with properties for make, model, and year. Then, show how you can access the model property of the car.
Question 80
Updating Object Properties: Add a property named `color` to the existing car object, and then update the `year` property to `2021`. Show how to perform these operations.
Question 81
Iterating Over Object Properties: Write a function that takes an object as an argument and logs all of its properties and values.
Day 28
Question 82
Find the Length of a String: Write a function that takes a string as an argument and returns the number of characters in the string.
Question 83
Converting to Upper and Lower Case: Create a function that takes a string, converts it to uppercase, then to lowercase, and logs both.
Question 84
Replacing Text in a String: Write a function that takes a sentence and replaces all instances of the word `JavaScript` with `TypeScript`.
Day 29
Question 85
Finding the Position of a Substring: Write a function that locates the first occurrence of the word `code` within any given string and returns its position.
Question 86
Checking for Text Presence: Create a function that checks if the word `JavaScript` is present in a given string. It should return `true` if found, otherwise `false`.
Question 87
Extracting a Substring: Demonstrate how to extract the first 10 characters from a string.
Day 30
Question 88
Converting Strings to Numbers: Write a function that takes a string representation of a number (e.g., `123`) and converts it into an actual number type.
Question 89
Rounding Numbers: Create a function that takes a number with decimals (e.g., `3.14159`) and rounds it to two decimal places.
Question 90
Generating Random Numbers: Write a function that generates a random number between 1 and 10, inclusive.
Day 31
Question 91
Create an array of your three favorite fruits and add a new fruit to the end of the array.
Question 92
Write a function to remove the last element from an array and return the removed element.
Question 93
Find the index of `Banana` in an array of fruits and replace it with `Mango`.
Day 32
Question 94
Use the .map() method to create a new array that contains the length of each word from an array of words.
Question 95
Write a function that uses the .filter() method to return an array of numbers greater than 10.
Question 96
Demonstrate how to use the .reduce() method to calculate the sum of all numbers in an array.
Day 33
Question 97
Write a function that returns the current date in the format `DD-MM-YYYY`.
Question 98
Create a JavaScript snippet that calculates and logs how many days are left until New Year.
Question 99
Generate a date object representing your next birthday and log it to the console.
Day 34
Question 100
Use the JavaScript Math object to find the square root of 144.
Question 101
Generate a random integer between 1 and 10.
Question 102
Calculate and log the absolute difference between the number -5 and 5.
Day 35
Question 103
Write a function that returns a random boolean value, true or false.
Question 104
Create a function that generates a random hexadecimal color code.
Question 105
Simulate a dice roll using JavaScript and return a random integer between 1 and 6.
Day 36
Question 106
Determine if a given year is a leap year using comparison operators.
Question 107
Write a condition using logical operators that checks if a number is divisible by both 2 and 3.
Question 108
Compare two strings to check if they are identical, ignoring case sensitivity.
Day 37
Question 109
Write an if statement that logs `Good Morning` if the current time is before 12 PM.
Question 110
Create a function that assigns a grade (A, B, C, D, F) based on a students score.
Question 111
Use an if-else-if chain to categorize a persons age group (child, teenager, adult).
Day 38
Question 112
Create a Map that stores the names of countries as keys and their capitals as values. Add three countries to the Map.
Question 113
Write a function that checks if a Map contains a key for `Canada` and logs the capital if it exists.
Question 114
Iterate over a Map of student IDs and names, and log each pair to the console.
Day 39
Question 115
Use a switch statement to log the days of the week based on a number (1-7).
Question 116
Create a switch case that matches several cases to the same code block, representing seasons.
Question 117
Implement a switch statement that evaluates an expression and uses the default case if none of the cases match.
Day 40
Question 118
Write a loop that logs numbers from 1 to 10 to the console.
Question 119
Create a while loop that logs `Hello, World!` 5 times.
Question 120
Use a for...of loop to iterate through an array of your favorite movies and log each one.
Day 41
Question 121
Implement a for loop that counts from 1 to 10 but skips number 5 using the continue statement.
Question 122
Use a while loop to count down from 10 to 1 and breaks the loop when it reaches 5.
Question 123
Create a loop that iterates through a string and stops when it finds the first vowel.
Day 42
Question 124
Create a function inside an object that returns the objects own name property using the this keyword.
Question 125
Modify a method in an object to use the this keyword to access another property in the same object.
Question 126
Explain how the this keyword changes its value when used inside a nested function within a method.
Day 43
Question 127
Convert a traditional function expression to an arrow function.
Question 128
Create an arrow function that takes multiple parameters and returns the product of all parameters.
Question 129
Explain how this behaves differently in arrow functions compared to traditional functions.
Day 44
Question 130
Explain how to export a function from one JavaScript file and import it into another file.
Question 131
Create two modules; one that exports a class, and another that imports the class and creates an instance.
Question 132
Discuss the difference between default and named exports in JavaScript modules.
Day 45
Question 133
Write a JavaScript object and convert it into a JSON string.
Question 134
Take a JSON string and parse it into a JavaScript object.
Question 135
Explain how you can format a JSON string with proper indentation for readability.
Day 46
Question 136
Use console.log() to debug and track the value of a variable inside a loop.
Question 137
Implement a try-catch block to handle potential errors in a block of code.
Question 138
Describe how to use breakpoints in browser developer tools to debug JavaScript code.
Day 47
Question 139
List three reserved words in JavaScript and create a valid use case for each.
Question 140
Explain the error that occurs when trying to use a reserved word as a variable name.
Question 141
Discuss the significance of the await reserved word in asynchronous JavaScript.
Day 48
Question 142
Create a Promise that resolves with `Hello, World!` after 2 seconds.
Question 143
Show how to use the .then() and .catch() methods to handle Promise resolution and rejection.
Question 144
Explain the use of the Promise.all() method with an example.
Day 49
Question 145
Create a function that accepts a callback and invokes it with some arguments.
Question 146
Show an example of a callback function used to filter an array of numbers.
Question 147
Explain how to handle errors in a callback pattern.
Day 50
Question 147
Demonstrate the use of the setTimeout() function to execute code after a delay.
Question 149
Explain the concept of the event loop in JavaScript with an example.
Question 150
Describe how asynchronous callbacks differ from synchronous code execution.
Day 51
Day-51 Task
Read the following article: Top 10 Programming Tips For Beginners.
Day 52
Day-52 Task
Read the following article: An Introduction to JavaScript
Day 53
Day-53 Task
Watch the following video to learn about Chrome DevTools: Fun & powerful: Intro to Chrome DevTools
Day 54
Day-54 Task
Read the following Articles and Code along with it:
Hello World in JavaScript
Variables in JavaScript
Day 55
Day-55 Task
Read the following Articles and Code along with it:
Data Types in JavaScript
Interaction: alert, prompt, confirm in JavaScript
Day 56
Day-56 Task
Read the following Articles and Code along with it:
Type Conversions in JavaScript
Operators in JavaScript
Day 57
Day-57 Task
Read the following Articles and Code along with it:
Comparisons in JavaScript
Conditional Operators: if, (? Ternary Operator) in JavaScript
Day 58
Day-58 Task
Read the following Articles and Code along with it:
Logical Operators in JavaScript
Nullish Coalescing Operator `??` in JavaScript
Day 59
Day-59 Task
Read the following Articles and Code along with it:
Loops: while and for in JavaScript
The `switch` statement in JavaScript
Day 60
Day-60 Task
Read the following Articles and Code along with it:
Functions in JavaScript
Function Expressions in JavaScript
Day 61
Day-61 Task
Read the following Articles and Code along with it:
Arrow functions Basics in JavaScript
JavaScript specials in JavaScript
Day 62
Day-62 Task
First understand what typescript is, and why we need it, then setup typescript using the following guides:
TypeScript Introduction in Simple Words
Setup TypeScript | Step-by-Step
Day 63
Day-63 Task
Learn about TypeScript types by using the following guide and coding along with the examples provided in it:
Multiple Types in TypeScript
Day 64
Day-64 Task
Learn about TypeScript objects by using the following guide and coding along with the examples provided in it:
Type Annotations with Objects in TypeScript
Day 65
Day-65 Task
Learn about TypeScript functions by using the following guide and coding along with the examples provided in it:
Type Annotations With Function
Day 66
Day-66 Task
Learn about different TypeScript type system concepts by using the following guide and coding along with the examples provided in it:
TypeScript Type System Concepts
Day 67
Day-67 Task
Learn about TypeScript arrays by using the following guide and coding along with the examples provided in it:
Type Annotations With Arrays in TypeScript
Day 68
Day-68 Task
Learn about TypeScript tuples by using the following guide and coding along with the examples provided in it:
Tuple Data Type in TypeScript
Day 69
Day-69 Task
Learn about TypeScript enums by using the following guide and coding along with the examples provided in it:
Enums in TypeScript
Day 70
Day-70 Task
Learn about TypeScript interfaces by using the following guide and coding along with the examples provided in it:
Interface in TypeScript
Day 71
Day-71 Task
Learn about TypeScript classes by using the following guide and coding along with the examples provided in it:
Class Type Annotations in TypeScript
Day 72
Day-72 Task
Learn about TypeScript generics by using the following guide and coding along with the examples provided in it:
Generics in TypeScript
Day 73
Day-73 Task
Learn about TypeScript type assertions by using the following guide and coding along with the examples provided in it:
Type Assertions in TypeScript
Day 74
Day-74 Task
Learn about TypeScript Debugging by using the following guide and debug along with it:
Debugging in TypeScript
Day 75
Day-75 Task
Read the following Article with interactive videos about How does the internet work? behind the scenes what happens, etc.
How does the internet work?
Day 76
Day-76 Task
Read and understand the following Visual Guide about DNS and DHCP.
What is DNS?
What is DHCP?
Day 77
Day-77 Task
Read and understand the following Visual Guide about SSL, TLS, and SSH protocols.
SSL vs TLS vs SSH Protocols
Day 78
Day-78 Task
Read and understand the following Visual Guide about the Web Vitals.
What are Web Vitals?
Day 79
Day-79 Task
Read the following Articles with interactive video about Basics of Authentication and HTTP Basic Authentication.
Basics of Authentication
HTTP Basic Authentication
Day 80
Day-80 Task
Read the following Article about the difference between Full Stack Developer or Software Engineer.
Full Stack Developer or Software Engineer – Which Way to Go?
Day 81
Day-81 Task
Read the following Articles and Code along with it:
React Foundation
About React and Next.js
Rendering User Interfaces (UI)
Day 82
Day-82 Task
Read the following Articles and Code along with it:
Updating UI with Javascript
Getting Started with React
Day 83
Day-83 Task
Read the following Articles and Code along with it:
Building UI with Components
Displaying Data with Props
Day 84
Day-84 Task
Read the following Articles and Code along with it:
Adding Interactivity with State
Displaying Data with Props
Day 85
Day-85 Task
Read the following Articles and Code along with it:
Installing Next.js
Server and Client Components
Day 86
Day-86 Task
Read the following Articles and Code along with it:
Learn Next.js
Getting Started
Day 87
Day-87 Task
Read the following Articles and Code along with it:
CSS Styling
Optimizing Fonts and Images
Day 88
Day-88 Task
Read the following Articles and Code along with it:
Creating Layouts and Pages
Navigating Between Pages
Day 89
Day-89 Task
Read the following Article and Code along with it:
Setting Up Your Database
Day 90
Day-90 Task
Read the following Article and Code along with it:
Fetching Data
Day 91
Day-91 Task
Read the following Article and Code along with it:
Static and Dynamic Rendering
Day 92
Day-92 Task
Read the following Article and Code along with it:
Streaming
Day 93
Day-93 Task
Read the following Article and Code along with it:
Partial Prerendering
Day 94
Day-94 Task
Read the following Article and Code along with it:
Adding Search and Pagination
Day 95
Day-95 Task
Read the following Article and Code along with it:
Mutating Data
Day 96
Day-96 Task
Read the following Article and Code along with it:
Handling Errors
Day 97
Day-97 Task
Read the following Article and Code along with it:
Improving Accessibility
Day 98
Day-98 Task
Read the following Article and Code along with it:
Adding Authentication
Day 99
Day-99 Task
Read the following Article and Code along with it:
Adding Metadata
Day 100
Day-100 Task
Read the following Article, and follow the given steps in it:
Next Steps