Skip to content

Escobar-is-there/Basic-Practice-of-JavaScript

Repository files navigation

JavaScript Practice Assignments.

I'd be glad to provide a breakdown of the class-wise code practice details, and addressing potential issues:

1. Class 1: Variables, Data Types, Comparison Operators

Focus:

This class focused on introducing you to the fundamental building blocks of JavaScript programming: variables, data types, and comparison operators. Here's a summary of the key points covered:

  • Variables: You learned how to declare variables using the var keyword (although it's recommended to use const or let in modern JavaScript). You practiced naming variables meaningfully and assigning values to them.

  • Data Types: You explored different data types, including: Strings: Textual data enclosed in quotes (e.g., "Rafiqul Alam") Numbers: Numerical values (e.g., 5, 59, 344) Booleans: True or false values (e.g., true, false) You used the typeof operator to check the data type of variables.

  • Comparison Operators: You practiced various comparison operators: ==: Checks for value equality (e.g., 5 == "60" converts "60" to a number, resulting in true) ===: Checks for strict equality (value and data type must be the same, e.g., 344 === "344" is false due to different data types) !==: Checks for inequality (e.g., 59 !== "hello JS" is true due to different types and values) You understood that when comparing different data types, JavaScript may perform type conversion, which can lead to unexpected results if not handled carefully.

  • User Output: You used the console.log() function to print the results of your code to the console. By completing the coding exercises in Class 1, you've gained a foundational understanding of the essential tools used to build more complex JavaScript programs.

  • Declaring variables using let or const keywords.

  • Understanding different data types (strings, numbers, booleans).

  • Performing comparisons using operators (===, !==, >, <, >=, <=).

First Assignment Link

2. Class 2: Arithmetic Operators, Conditional Statements

Focus:

This class focuses on consolidating your understanding of arithmetic operators and conditional statements through practical JavaScript coding exercises. Here's a breakdown of the key points:

  • Arithmetic Operators: You'll practice using the basic arithmetic operators (+, -, *, /) to perform calculations in your code. Examples include calculating the total cost of items in a shopping cart or determining if a year is a leap year.

  • Conditional Statements: You'll gain experience with the if...else statement to make decisions based on conditions. Examples include checking user input against pre-defined values for login systems and determining letter grades based on average scores.

  • User Input: You'll learn how to use the prompt-sync library to take user input from the console. This allows your code to interact with the user and make decisions based on their input.

  • Data Conversion: You'll see how to convert user input from strings to numbers using the Number() function. This is necessary for performing calculations with user-provided data.

  • Applying Discounts: You'll explore using conditional statements and arithmetic operations to apply discounts to a total cost based on certain criteria. This demonstrates how you can utilize these concepts in real-world scenarios like shopping cart calculations.

  • Letter Grade Calculation: You'll practice using conditional statements to assign letter grades based on calculated averages. This reinforces the application of conditional statements for decision-making. By completing the coding exercises in Class 2, you'll solidify your grasp of essential programming concepts through practical application.

  • Performing basic arithmetic operations (+, -, *, /).

  • Using if statements for conditional execution based on comparisons.

Second Assignment Link

3. Class 3: Logical Operators, Loops

Focus:

This class focuses on solidifying your understanding of logical operators and loops in JavaScript through practical exercises. Here's a breakdown of the key points:

  • Logical Operators: Application in conditional statements: You'll practice using && (and), || (or), and ! (not) to combine multiple conditions and create more complex decision-making logic.

  • Loops: You'll become proficient in using (for loops:) to iterate over a specific number of times, as seen in summing series of numbers and finding even/odd sums. Controlling loop flow: You'll explore conditional statements within loops to selectively execute code based on certain conditions.

  • Series Calculations: You'll learn how to calculate the sum of numbers (Sum of a series:)within a given range using for loops and accumulator variables. Sum of even/odd numbers: You'll practice calculating sums for specific sets of numbers (even or odd) using conditional statements within loops. Arithmetic series: You'll work with formulas for finding specific terms and sums of arithmetic series.

  • User Input: For (Dynamic calculations:) You'll practice taking user input to make code more versatile and adaptable to different scenarios.

  • Output: Generate (Console output:) You'll continue using console.log() to display results and track code execution. By completing these coding exercises, you'll reinforce your ability to create more complex and controlled JavaScript programs.

  • Combining logical operators (&&, || , !) for complex conditions.

  • Using for loops to iterate over a specific number of times.

Third Assignment Link

4. Class 4: Arrays

Focus:

  • Arrays :

1. Creation and Manipulation: Initializing arrays, adding elements, accessing and modifying elements.

2. Iterating with Loops: Using for loops to repeat actions for each element.

3. Storing Results: Saving calculated values or strings within arrays for further use.

  • Matrices:

1. Creating and manipulating arrays.

2. Using loops to iterate through elements.

3. Checking for even/odd numbers and storing results.

4. Modifying elements within matrices.

5. Converting 2D matrices to 1D arrays.

  • User Input and Output:

1. Taking user input to create arrays dynamically.

2. Displaying array contents for comparison.

  • Sorting: Applying the sort() method to arrange elements in ascending order.

Fourth Assignment Link

5. Class 5: Functions

Focus and Overview:

This class emphasizes functions and their applications in JavaScript programming. Here's an overview of the key areas covered:

1. Introduction to Functions:

Defining functions: You'll learn how to create functions using the function keyword, assign parameters, and write code blocks to perform specific tasks.

Function calls: You'll practice calling functions and passing arguments (values) to be used within the function. Returning values: You'll write functions that return calculated results or retrieved data.

2. Applying Functions:

Equation calculation: You'll create a function to calculate the value of Y in the equation Y = x^2 + 2x + 6 based on the provided input (x).

Callback functions: You'll work with functions passed as arguments to other functions. In this exercise, you'll create separate functions for addition, subtraction, and multiplication, and then call them within a main function to perform calculations on two user-provided numbers.

Default parameters: You'll define a function with a default parameter for the user's name, ensuring the function works even if no name is provided during the call.

3. Array Manipulation:

(.map() method:) You'll utilize the built-in .map() method to create a new array containing the square of each element in the original array.

Through these exercises, you'll gain a strong foundation in function creation, utilization, and their role in code reusability and modularity. You'll also explore how functions can be used for calculations, user interactions, and manipulating data within arrays and their power in creating modular and efficient JavaScript programs.

Fifth Assignment Link

About

Welcome to my first repository on GitHub.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published