Javascript Advanced Array Methods With Code Examples | Somenath Sen | Skillshare

Javascript Advanced Array Methods With Code Examples

Somenath Sen, SkillShare Instructor Teaching 100+ Classes

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
6 Lessons (24m)
    • 1. Enroll Now !

      0:27
    • 2. "Pop" Method

      6:06
    • 3. "Join" Method

      5:35
    • 4. "Reverse" Method

      3:57
    • 5. "Push" Method

      4:20
    • 6. "Short" Method

      3:45

About This Class

In this class you'll learn about javascript advanced array methods with live code examples. So Enroll the class now !

7ced6e31

Transcripts

1. Enroll Now !: 2. "Pop" Method: All right. So indoor previous video will learn about the join mate Orange L A script. And in this video, we're gonna be learn about the pot metal in trouble strip. So first of all, on Goto our poor yet Fuller and create a walkable copy for these German document. Just copy and pasted. Andi rename this to in its hyphen instead on wreck. Click on this file and open it in Northwest Closeness. So what is a port Meter? Hope Meadows? Actually, JavaScript will pop up or removed some index into the attic. So let's try apartment or here, and let's see how it looked like and how it work. So first awful. I'm just removed this joint over here because we don't need any join. So first of all, let's just sprint out a name into a browser from this area. So let's say we want to print out Ah, Rick into our browser. So first we have to just died the variable name, which is names, and then we have to type our index number within this square bracket. So in this case, the in this number for Rick is zeal, one true. So we type two here, and it will print out the Rick in our browser, as we all know that. So first of all is this ticket into our brother Goto our project polar and double click on this Wild. Open this up in the browser, and now, as you can see her, it print out the Rick naming Tor browser. All right, so now go back to our text editor and let's just try the hope method. So first of all, if you want to type apartment hard, you want to type the really real name cause, so names. Then you have toe type a dot. Then you have to add the pop metal so B o. P for populist or and then you open your friend is his record, and after that we have to add a semi colon. Then let's just go ahead and friend the same name from the browser and let's see how it look like just praised the same document, that right, which will trigger the Rick value from this area. And let's see how it looks like so and one more thing we have to add a line break after this horse document that right so it will print out a Sligon Value indoor next line. Just add our line break and save the file and goto our browser on Reload the page. Now, as you can see here, does not bring the value wreaking door browser. It just bring undefined, undefined means Oscar. It will find nothing so it will print out Are Undefined Ward indoor browser on Let's Go Back to our text editor on Let's See the We just print out the same value theme index name , Which is we just spring doubt previously any it will print out the rig name, but why? It will not print out the same value after this pope myth or because this pope method will remove the last index number for my Harry. So it will just remove the rig value into the area for just dead the mosque. It will not find this rig value, and it just brings out on defining our browser. And let me just give you another example. If we can copy and paste the same part. Midhar After this document, daughter right, and we just cleaned out that one index number which will identify as Anna like zero one, so it will the Ener, so it will print out the an indoor browser on Let's see. Is it a little print or the an indoor Rosa or not? Now let's add some. Be a tag after this in this number, so it will print out the value in the next line. Also, let's Annabi attack in hair as well, so save the file and good over Project folder and double click on this vile and open this up in the browser. And let's see how it looks like now, as you can see here. First of all, we have the Rick name, which will print out normally. Then we had the bottom it hard, and it will prop up the Rick name from the area so it will undefined into our browser. Then we had another pop metal, and it will remove another very from this area. So Anna also be undefined. And if you can change this in next name, 200 will be the Joan. So 01 to 0 will be that John. So if I said the file and go to our browser and reload the pit now, as you can see here, we can only have one value into our at if, which is John and John will print out in our browser. So in this way, you can use this pope met Haar. Bach. Matori is actually doing it. Just removed the last value from the Ari. So you can use this pop myth hard in JavaScript. And if you want to remove the last value from the Eyrie, it will the easiest process to do that. 3. "Join" Method: All right. So now we know all people, even handlers in JavaScript. So in this video, we're gonna be learned some interesting, which is called Join. So let me just go to my project folder. Andi, copy and paste this file over here and create a walkable file called this Human Joe Coleman . Just remember this tree Next. Hi, friend. Join and right Click on this file and open it in. No pack plus plus. So, first off, all I'm just removed this even handler into this body on as well as removed this link from here. No Indo us Crypt AG. We read in our joint courts. So what is joined? Join is actually a job script in visual function ritual. Convert our area into a string. So let's see how we can create a joint on how to use it. So, first of all, let's just create a variable next, then given equal sign. Then let's just make a very real call names. All right, which will look more logical. So now we have our area. It is very evil. So new at a your caps, then into the French asses. This is give some names like John then keep some Ana, then given name Rick. And after this, give a semicolon. No, we have to open and other video girl regional a joint that's their medieval X, then given equal sign. And then we have toe return our first variable name, which will we convert into Aris? So in that case, religion here names, then we need to type a dot. Then we have to type join. Then we have toe open or scientists bracket. And I thought that we have to return a semi colon now, As you can see here, we could not pass any perimeters in this joint. Let me just tell you why we could not pass any parameters in here in couple of minutes. So first of all, let's just print out this eggs available indoor browser and let's see what's happening. So let's just type document door right, and into this document dot right? We just crossing our xperia bill now save the file and go to our project cooler and double click on this fight. Open this up in the browser and let's see how it looks like now, as you can see here, it just print out our Eddie's as a string, as we can mention before it just print out. Our at is as a string, but it will print out our areas index with separated by a comma. This is vital Fall joint will print out at his index into the browser. But if if you want to separate it, this area's index with a hyphen. So how we can do that In this joint fantasies, we just give a double condition, and into this quotation, we just type are parameters. So in this case, we just type a hyphen, then save the file and go to our browser on reload the page. Now, as you can see here, you just passing the hyphen instead off this calmer, so by default, jointly supported at his index by comma. But if you want to change those commas toe whatever you want, like ah, hyphen or a systemic alone or whatever you want you just passing those parameters in this joint Francis's bracket and save the choir, and it will just display into the brother now, as you can see here. So in this way you can use this joint in JavaScript to convert any Cherries into a dynamic stream 4. "Reverse" Method: Alright, guys. So now we know Join and hope and a myth. Hordes on. Now in this video, we're gonna be learn about a new era May thought Call reverse. So let's just go ahead. Indoor project holder and creditor. Walkable. Copy for this. A steamer Taco Menge, Where is the John now? Copy and pasted over hair and renamed it to index hyphen. He was on record on this file on Open it in notepad plus plus. No, First of all, this is removed his document. Right. Come here because we don't need it in here on if you want to create a reverse, Harry met her as the name of sounding light. It's airy metal, so you obviously need a airy. So in that case, we already have an area into one names Really evil. So let's just try our divorce Smith or what re forced me, authorities. John, is it just reverse that is indexed by loves to first? That means if I want to try a divorce, Midhar than Rick will Our index numbers video than Anna will want them. John will chew. So let's just try this, reversing it hard and show you guys how to create is reverse, met hard and how to use it. So, first of all, let's just try the real evil name, which is name Andi. Then Daut has, like the previous at his mentor on. Then we want to type reverse. Then you have to type your friends decade and after that, give us a semi colon and that's it. So let's just try one index number from this area into our browser on. Let's see how the reverse will work. So let's just right document dot right then into your friend of these. Then after that, give up semicolon and into the front of this business type. You're very well name names. Then you have to open your square record and into the square record lizards. Type that in next number from the area, so let's just try with zero. So, first of all, look at this. If why, I want to print out zero so it will print out that Sean. But as I mentioned before, reversing a method will refers the arraigned next by last to first. So now the zero will be the reek, so it will print out Reagan Door Brothers Eliza Stride indoor Broza. Just save the file and go to our project. Fuller on. Don't go on this wild. Open this up in the browser and let's see how it looked like. Now, as you can see here, it print out the Rick Indoor browser. And if I go to my text editor on try to two years, probably that Joan, because reversed anime Third will regards the areas index numbers. So 1st 1 is John now the last one. So let's astride also into our brothers if the file and got over browser and reload the page. Now, as you can see, her join in this number is now too. So in this way, you can use this reverse mint heart to reversed any other index number. 5. "Push" Method: Alright, guys. So indoor previous video We learn about the reverse methought on in the video. We're gonna be learn about another myth or called Booth. So let me just go to my project folder on create a workable copy for the best email. Just copy and pasted over here and rename it to in next hyphen boost. No. Right. Click on this file and open it in no back plus plus. No. What is the post metal? The postman hard will pose some values into your existing Harry. So let me just try that push. Met hard and give you a brief explanation. So just remove this reverse from hair. Now we have our names variable whichever areas in it. Now, let me just try the post method and pushed some to men's into this existing area. So first off, all you have to type your variable name names, then died dot Then you have to type bush, then open your fantasies. And after that, give us cynical and into this fantasies, we have to pass our parameters that we want. Toe puts it into this existing Eric. So let's say we aren't took post a name. Call George George on also, we under post another name Call. Let's see, Dave. All right, so we want this to names into this existing areas. So we use the post method. What this post, Mr does, is it just pulls this two names this to at is value into this existing area. So in that case, the end is in this Numbers would be looked like this 01 to three four because post Met hard will post the new value into your existing very after the last index. So after the reek, that just will coming. And after the jaws that Dave will come in. So in that case, the areas in the number should be like this. 012 34 So let me just try a document. Not right. They were here talking in dog, right? When a friend of then after that, he was gonna into this went to this visit style names on open your square bracket and into the square bracket. Let just type the index number called four, which will print out that Dave into our browser. So let me just try it into our browsers. Said the file goto the project folder and double click on this filed. Open this up in the browser and let's see how it looked like. Now, as you can see here, it can print out that Dave Indoor browser on If you want to try hair three instead of this four in next number, it will point out that chose indoor Broza. So let me just try it as well in your brother listens. Reload the page. Now, as you can see here, it just window jaws into your browser. So in this way you can use this post myth heart and who's a single value or a multiple value into your existing Harry. And it will be very helpful when you have to try thousands of lines. Of course, after the area now you don't want to find the area toe, put some more value into it. You just want to write a single line. You just want to use this whose method? Toe whose new development your existing any. So in this way you can create this post made hard and use it in JavaScript 6. "Short" Method: All right, guys. Eso Now, In our previous video, we learned about a postman heart. And in this video, we're gonna be learn about the last Adam it hard call short. So let me just go to my project folder on and create a walkable copy for this estimable document. Just copy and pasted over here on Renamed it to index hyphen. Short on directly on this file and open it in Northwest Crustless. So what is the short mated? Short mid hard is shorten. This area is value by their alphabetical numbers. So let me just try the short metal for you and show you guys how this will work in javascript. So let me just remove this Portsmouth out from here because we don't need it. Andi, after this. Very well. We want to type the variable name first names. Then we have to die the dot. Then we have to type shock on. After that, we have to open our friend disease. And after that, we have to keep the semicolon. Andi, that's it. So, Liz, print out this It is in this as a shrink as a teacher is in the previous video, we'll need to add the joint mitt Hard toe, print out This that is indexed as a stream into your browser. So let me just open another variable hair. Who are X X is real name, then given equal signed and type no video names. Then when do I dot then went to tape join Then the front is is And after that, give us Temuco. Then we want to document that, right? That ex very well document dot Right on. And here we want to print out the X variable which will print out this. It is in this as a string on. Also, there's gonna be shortened using their alphabetical number because we are using the short at a Met her here. So let me just try it into your browser, save the file and goto our project folder and only on this pilot. Open this up in the browser and let's see how it looked like now, as you can see here. First of all, let's go to our text religion on, See the area values over here. First of all, we have the John. Then we have the Anna. Then we have the Rick. But we just tried a short metal short mitt Hard will short in this area is value into their alphabetical number. So let me just go to our browser and let's see how it will print out. Now, as you can see here, it will print out and our first because E is the very first alphabetical numbers. So it will print out and our first, then that joined in the rig so it will short in this area is value as ultra critical order . So you can use this short Midhar too short and you at his value by their own political numbers.