Skip to content

This repository includes all basics of JavaScript . It is a perfect option for beginners and those want to refresh their knowledge. This repo includes practical examples so far, and the comments explains everything from A-Z.

Notifications You must be signed in to change notification settings

Hameedullah-Asadi3300/JavaScript-Repo-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript-Repo-1

image

  1. Comments

  2. Strings

  3. Basic math

  4. Variable Data Type

  5. Array

    a. ArrayMethod b. Map()

  6. Functions

  7. Booleans and conditional statements

  8. Switch Statements

  9. Objects

  10. Loop

  11. Template Literal

  12. Method

  13. this keyword

  14. object constructor function

  15. For of and For in Loop

  16. Break, Continue and Labels

  17. Set

    a. set.js b. set_method.js

  18. TypeOf

  19. Errors

  20. Number

    a. BigInt b. NumberMethod c. GlobalMethod d. NumberProperty

  21. Math

  22. Date

  23. Class

    a. class.js b. class_inheritence.js

Description

Comments

  This very small project is about types of comments and how to comment code in JavaScript.

Strings

  This project contains all of the following aspects of string data type:

Syntax, escaping characters, escape sequences like ", ', \n, \t, \r, \b, concatenation, .length property, and immutability.

Basic Math

  This projects includes all mathematical operations in JavaScript. Worked with 
  arithmethic and assignment opertaors. I also worked on math.random/generates
  radnsom decimal and ParseInt/converts string to int functions.

Variable Data Type

  This project allowed me to work on all the methods of variable declaration and values intialization.
  var         Is accessible anywhere in the code
  let         Is accessible within the scope declared 
  const       Is used for values which are fixed and not muteable

Array

  In this project I have worked on arrays in JavaScript, syntax, modifying the elements
  of arrays using the index, functions of arrays like:

  ArrayMEthods
  The array_methods.js file contains all array methods in JavaScript as follows:
  toString()                          Returns an array as string with comma as seperator
  length()                            Returns length of an array
  pop()                               Deletes the last value
  shift()                             Deletes the very first value
  Unshift()                           Adds a value at the first with index 0
  deletd()                            Remove a value from an array
  slice()                             Slices part of an array/values into a new array
  splice()                            Removes values without leaving holes/undefined in an array       
  flat()                              reduces the dimensionality/nested of nsested array
  concat()                            concat method concatenates two arrays

Functions

  In this little project, I have worked on functions in JavaScript, concatenation, 
  conditional statement of if and else if inside the function
  and return statement with number and string data types whithin the functions.
  I also worked on how a function returns a value and how a function acceps a single and 
  multiple values.
  This project also includes function expression.

Booleans and conditional statements

  In this project, I have worked on followings:
  a. booleans
  b. conditional statement - if, else if, and else statements and chain of if, else if, and else statements
  c. all comparison operators like: ==, ===, >, <, >=, <=, !=, !==,
  d. logical operators: !, &&, and ||

Switch Statements

  This JavaScript project contains switch statement with default option, and multiple indetical options
  used as cases to return the same value.

Object

  Inside this project, I have worked on how to create an object, nested objects, how to access to
  properties inside the object and nested objects,
  how to remove a property from an object, and how to add property and value using both
  dot and bracket notations.
  It also contans the JSON.stringify function.

Loop

  In this .js file, I have worked on all three types of loops, for, while and do while loop.
  It also includes anested loop.

Template Literals

  This project actually allow me to know the basic and fundamental philosophy behind the Template literals.
  In this project, I also worked on placing the variables inside the string using `backtick` characters.

Method

  In this project I have worked on the syntax for method within an object.

this Keyword

  In this little project, I have worked on this keyword, its usage and its function with objects.

Object Constructor Function

  In this project, I have worked on how to create an object constructor function to use it as a blueprint
  for other objects.

For of and For in Loop

  In this project, I have worked on "for of loop" and "for in loop" within array.

Break, Continue and Labels

  This project contains practical examples of break used within switches and loops. It also contains examples of
  continue statements and JavaScript labels.

Set

  set.js
  This set.js file contains JavaScript syntax for set and the basic undertading.

  set_method.js
        1.    add()         | Added the values using the variables
        2.    values()      | Iterates the values in a set
        3.    size()        | Returns the size of a set in number
        4.    delete()      | Removes the vaues by passing the value itself, not the index
        5.    has()         | Returns if the value exits or not with "true" and "false"
        6.    new Set()     | creates a new set
        7.    size property | returns number of elements in a set

TypeOf

  Typeof.js contains practical examples of all data types that can be hold in JavaScript Variables.

Errors

  The erros.js file contains practical example of how to handle error with try, catch, throw, and finally code blocks.
  I have also listed values(ErrorNames & Description) of JavaScript built in error object which are as follows:
        1.   SyntaxError
        2.   ReferenceError
        3.   TypeError
        4.   RangeError
        5.   URIError

Number

  This project has a few other files, each discuss an important concept in Number and BigInt Data types.
  
  Number
  This number.js contains practical examples of number data type in JavaScript.  
  
  BigInt
  The bigint.js contains how to declare and assign a BigInt, the purpose and some other concepts as follows:
        1.   Number.MAX_SAFE_INTEGER   |   Return the maximum safe integer in JavaScript which is 9007199254740991
        2.   Number.MIN_SAFE_INTEGER   |   Returns the minimum safe integere in JavaScript which is -9007199254740991
        3.   Number.isInteger          |   Used to return true if a number/value is integer
        4.   Number.isSafeInteger      |   Returns true in a number is safe integer
        
  NumberMethod
  The number_method.js file contains the following number methods:
  1.   toString()                       |       Returns a number as string
  2.   toExponential()                  |       Returns a number written exponential notation
  3.   toFixed()                        |       Return  a number written with a number of decimal
  4.   toPrecision()                    |       Returns a number with a specified length
  5.   ValueOf()                        |       Returns a number as a number
  
  GlobalMethod
  The global_method.js contains global method in JavaScript as fllows:
  1.   parseInt                         |        parses a string and returns a whole number
  2.   parseFloat                       |        Parses a string and returns floating point number
  3.   Number                           |        Returns a number and converted from its argument

  NumberProperties
  The number_properties is all about number properties in JavaScript as follows:
  1.   Number.EPSILON
  2.   Number.MAX_VALUE
  3.   Number.MIN_VALUE
  4.   Number.MAX_SAFE_INTEGER
  5.   Number.MIN_SAFE_INTEGER
  6.   Number.POSITIVE_INFINITY
  7.   Number.NEGATIVE_INFINITY
  8.   NaN

Math

  The math.js file contains following math methods:
  Math.round()                        Math.trunc()
  Math.ceil()                         Math.sign()
  Math.floor()                        Math.pow()
  Math.squrt()                        Math.abs()
  Math.min()                          Math.random()
  Math.max()                          Math.

Date

  The date.js file contains the synatx and basic syntax of date object.

  DateMethod
  The date_method.js file contains a few mostly used date moethods such as:
  toDateString()                                    getFullYear()
  toUTCString()                                     getDay()
  toLocaleString()                                  getDate()
  toJSON()

Class

  The class.js contains the defination and the syntax for creating a class.
  
  b. class_inheritence.js
  This file includes the practical example of class inheritence in JavaScript.

Destructure

  In destructure.js contains practical examples of array destructuring.

Spread Operator

  Spread Opertor intoduced in ES6 and allows quick copy all or part of the array or an object. The spread_operaotr.html
  includes example of spread operator as follows:
  const number1 = [100, 200, 300];
              const number2 = [400, 500, 600];
              const combination = [...number1, ...number2];
              document.write(combination);
              //      It combines and prints all values in both arrays.
              
              const myNumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
        
              //  In the following line, we assigned the 1 and 2 to the variables one, and two and the rest to the array named restInArray
              const [one, two, three, ...restInArray] = myNumbers;
              document.write("<p>" + one + "</p>");           //  prints to the console
              document.write("<p>" + two + "</p>");           //  prints to the console
              document.write("<p>" + restInArray + "</p>");   //  prints to the console
              /*
              It will return:
              1
              2
              3,4,5,6,7,8,9,10
              */

  It also includes a spread operator working with objects:
              const myVehicle = {
                      brand: 'Ford',
                      model: 'Mustang',
                      color: 'red'
                    }
                    
                    const updateMyVehicle = {
                      type: 'car',
                      year: 2021, 
                      color: 'yellow'
                    }
                    
                    const myUpdatedVehicle = {...myVehicle, ...updateMyVehicle}
                    //      prints it into the console
                    console.log(myUpdatedVehicle);

About

This repository includes all basics of JavaScript . It is a perfect option for beginners and those want to refresh their knowledge. This repo includes practical examples so far, and the comments explains everything from A-Z.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published