Simple And Multi Dimensional Arrays in Typescript With 2D Arrays Typescript Mastery Ep 4

Поділитися
Вставка
  • Опубліковано 9 лют 2025
  • Hi all, in this video we are going to discuss the arrays in the typescript. Arrays are data structure that you will find in pretty much any language.
    We are going to see what is an array, how to use it, when to use it, see some examples on using arrays.
    We will also look at different ways to create an array. Create empty array, initialised array, undefined array, using Array class, and much more.
    We will also look at crud operations in the array :
    Creation / Insertion - push, unshift
    Deletion - pop, shift, splice,
    Updation of the element
    Read or getting a particular element from the array.
    Array is just a collection of data of same datatype. So a collection of strings is an array, a collection of numbers is an array, etc
    We use [ ] brackets to denote array. We can use array to store names of people in the memory.
    We declare array like :
    let myArray : string[ ]= [ ];
    Then we are going to also discuss what are multidimensional array and where to use them.
    Then we see the 2D Array in typescript and we create it, initialise it, add elements to it and read from it.
    2D arrays are greatly used for matrices programming but there are many use cases for it.
    For those who want quick info :
    Array is a way to group or store data of same datatype. We declare it like : "
    var myArray: string[ ] = [ ];
    Then we can also add element during declaration :
    var myArray: string[ ] = [ "Ram", "Sita"," Laxman","Hanuman"];
    You can access elements on the basis of index. Indexing is 0 based so for accessing "Ram" write :
    myArray[0];
    You can do crud operations using :
    push
    pop
    shift
    unshift
    splice
    You can update array be accessing a particular element and giving it a new value :
    myArray[0] = "Rama";
    Then you can create 2D array like below :
    var my2DArray : string[ ][ ] = [ ];
    2D array can look like :
    var my2DArray : string[ ][ ] = [ [ "Ram", "Sita", "Laxman", "Hanuman"], [ "Krishna" , "Radha" , "Balram" ];
    Now you need to see the video to understand concept. There are just so many things to write in description so video is better option.
    We hope this video was helpful to you. If you have something to share then comments sections is waiting for you :)

КОМЕНТАРІ • 2

  • @OGL.
    @OGL. 19 днів тому

    🇧🇷🇧🇷🇧🇷🇧🇷🇧🇷🇧🇷🇧🇷🇧🇷👌👌👌👌👌👌

  • @OGL.
    @OGL. 19 днів тому

    Faz o vídeo mais curto pra ganhar visualização 🇧🇷🇧🇷🇧🇷🇧🇷