Manipulating and Sorting Arrays in JavaScript

Поділитися
Вставка
  • Опубліковано 9 лют 2025
  • An introduction to the idea of being able to add or remove items in the middle of an Array. You can replace a single item in an Array with a whole new list of items.
    Additionally, how to sort an Array and how to locate items in an Array is discussed.
    Mozilla Developer Network Array.splice reference - developer.mozi...

КОМЕНТАРІ • 32

  • @yunusmile
    @yunusmile 4 роки тому +11

    i have watched almost 10 channels and yours is the best, i need a teacher that treats me like an idiot, giving simple examples, other youtubers act like everyone already knows codes and gives an example of a whole program wtf, thank you

  • @ProgSoundN_A-cube
    @ProgSoundN_A-cube 4 роки тому +2

    i don't know why am commenting this late, but i have been watching your videos since 2 years today. and when ever i forget something or just need to refresh my mind, i turn to your channel. thanks much for the great work, simplicity in your videos makes it even more recommending to beginners

  • @ilyafredriksson
    @ilyafredriksson 3 місяці тому

    Thank you so much for sharing this knowledge!.I have used many channels to learn JavaScrip and yours are the best so far!
    after struggling on my own . Ur videos simplifies things a lot and helped me alot!!!

  • @jetspray3
    @jetspray3 Рік тому

    I have used many channels to learn JavaScript but now I'm going to used your channel to solidify my knowledge of JavaScript before I move on to React.

  • @anthonyfrimpong5473
    @anthonyfrimpong5473 4 роки тому +1

    Just found you video after struggling on my own . Ur videos simplifies things a lot. Thank you very much for your time.

  • @rotrose7531
    @rotrose7531 4 роки тому +1

    If youtube really cares web development technology, they should make your channel appear first whenever viewers search web-related things. Many care about new things and they do forget all those tricks are based upon these fundamentals. And you are the only one who can explain everything that everyone understands.

  • @vinodliyanage4128
    @vinodliyanage4128 4 роки тому +4

    Thank you so much for sharing this knowledge with us.👍
    Small tip, if you want to add values into your list instead of removing them, you can do that with splice
    Splice(1,0,add anything)
    Use 0 for second parameter.

  • @bondimoni
    @bondimoni 5 років тому +1

    Thanks Steve, I hope I can buy you a beer sometime in Amsterdam! Really useful videos you make!

  • @mnfak4333
    @mnfak4333 3 роки тому

    Watching this on March 2021 😁. Thanks for the video. It really helps as i am struggling with JS

  • @rotrose7531
    @rotrose7531 4 роки тому +1

    Second round, amazing tutorials. Thank you.

  • @chesterxp508
    @chesterxp508 3 роки тому

    Brilliant tutorials !!!

  • @prabu2778
    @prabu2778 5 років тому +2

    Sir you are good teacher!!!!

  • @ozzyfromspace
    @ozzyfromspace 5 років тому +1

    splice(a,b,*(c,d,...,n)) seems much better than push, pop, shift, and unshift. It's 1 method that can behave like all 4. Simpler and more generic. Thanks Steve! 🙌🏽 The Star Wars are strong with you btw 😊

  • @ProgSoundN_A-cube
    @ProgSoundN_A-cube 4 роки тому +1

    I remember when i downloaded 108 videos of your course just to stay on track😎😂

  • @TheCoffeeCreative
    @TheCoffeeCreative 3 роки тому

    Well you gained a new Sub. Great help as I am learning JS

  • @amanagasthya
    @amanagasthya 4 роки тому

    Thankyou for such an amazing tutorial

  • @vishalkhokar6303
    @vishalkhokar6303 5 років тому +1

    thanks sir explanation is very good

  • @logancarvalho
    @logancarvalho 4 роки тому +2

    I´d like to add something: if you want to add an item into the array using a non-existent index, you can do it using splice function too. Not conventional but...
    Ex:. Considering the array [ 'Rey', 'Kylo', 'C3PO' ], if you want to add at the end of this array you could write: characters.splice(3,1,'R2D2');
    The array, when printed on console, will look like: [ 'Rey', 'Kylo', 'C3PO' ,'R2D2']
    Is it a bug? IDK.
    Anyways, thanks for your videos, the´re great!

  • @nelsonjimenez7939
    @nelsonjimenez7939 5 років тому +2

    Terrific.

  • @damo190
    @damo190 3 роки тому

    console.log(a2, delete a2[a2.length-1], a2);
    I am not getting the correct result here. First and last a2 in console.log results same output which is the result of after deleting an item from the array.

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 роки тому

      Delete is for removing properties from objects. If you want to remove items from an array then use shift, pop, slice, or splice.

    • @damo190
      @damo190 3 роки тому

      @@SteveGriffith-Prof3ssorSt3v3 Sir, I used pop(). But the result is same. If I use,
      console.log(a2, a2.pop(), a2);
      I get wrong result. Here the result of both a2 are same.
      So I have to use two statements to get the correct result, just like,
      console.log(a2);
      console.log(a2.pop(), a2);

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 роки тому +1

      @@damo190 oh. I see what you are saying. Yes. You should not put function calls inside the console log calls combined with other things. Console log the results of your calls.

  • @lenomarin3484
    @lenomarin3484 8 років тому

    This is great! Thanks!

  • @diperman
    @diperman 6 років тому

    suppose i have an array a = [abc1, abc2 , 2 ,3 ,abc4,5,6,7,abc8,,......]
    and i want to remove items which starts with abc.. . how can this be done

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  6 років тому +1

      I would recommend the Array filter method. It is designed to do things like that. Here's my tutorial on that - ua-cam.com/video/WrB_--bVbbs/v-deo.html

  • @trenthogan4212
    @trenthogan4212 6 років тому

    Excellent!!

  • @Manish-jt1fi
    @Manish-jt1fi 6 років тому

    It will be better to understand and will be clean if you comment unnecessary console.log() . Overall you rocked.

  • @johnywhy4679
    @johnywhy4679 4 роки тому

    Tip: You can search for a sequence of elements:
    characters.indexOf('Han', 'Chewie')