Angular 4th Class In English Praveen Gubbala 9059868766 I 07th may 2019
Even. If you can write down the output that. Would be good that would be great okay. Let us see, so. I will explain you what is the answer over here after pushing the. 44. The. Array will become. Like. This, array. Will become, 31. Comma 44. So. After. Pushing 99. That. Array will be. Like. This. 1021. 4312. 3144. And 99. So. That if you print, it over here, the, value of the, array will, be like. This right. Once. I can guys I had to put some comments so comment section over here otherwise, it will be an it will become another okay. So here, if you see this so, here, if you because. I have popped so, what happens 99. Will be removed right. 99. Will be removed and. Because. Of one more pop. This. 44. Will also been removed. Because. Of one more pop. This. 31, will be removed. Because. Of one more pop. That. 12, will also been removed. Right. So. Ultimately I am going to get 10 21. And. 43. So let us see the output finally. What is the output 10 21, and 43. This is what I am expecting. Oh ho. Trent. 21:43. As well, as 12, so, I have done some mistake somewhere, I don't, know where I, have done it okay. So. After. Dropping. 99. Will be removed 44, will be removed. So. How many pops are there one two, three, four so. 99. 44, 31 and 12. Of course. And. Finally. It should be. 10. 21:43. Only. Hmm. Yeah. 12, should not be there that's what my, thing. Is okay, no not an issue let us even. If it is a see. Here I have, not popped a year I have not called the function I had just written the function, there. Here. Unfortunately. The function, call got missed, this. One okay. Now if I check it out yes. 43. Will be there so. 1210, 21:43. And what. Is it well 21, and 43. Is it clear Aakansha. Concha can you hear me are you getting the, slow. Or not. Hello. Yeah conch are you getting my page. Yes. Sir yes I am getting your voice I'm getting your conscience okay. That's right. So. Let's. Go to the next point this is about push and pop like, this you can I have so, many other concepts. Also so anyways. I will remove these all. Outputs. Okay. Hmm, cello. You. Got, you. Finally you understood, what is the output over, here so, the output, is this. Yeah. So, now. I will, explain you there is one function, called air dot. Shift. Okay. You just check it out the syntax. Of shift. Over here I will. Come to splice deleted. Everything now, see, here the. Array name and function. Called shift. Shift. Will, remove, the value, from the beginning. Of the array from the starting of the array so, shift will remove this ten and now, the new, array will, be ten. Sorry. 21:43. And. 21. And 43, so this 10 want to be available this is what my, output. Expected. Output is so you just just, check it out or. Token. What. Happen. Which. Line. HTML. Line number four line, number four. Line. Number, four okay. Yeah. Can you see this line number 13 the output, is 21, and 43, line. Number 13 and 21, and 43. I'm. In line number. Sorry. What, was the miss line, number 4 I, missed. To close this array oh. Okay. Fine. So now that this is about unshipped, now let us understand, what is sorry, this, is about shift let us understand, about unshipped, so. Unshipped. Expects. A number, which will push the, value R insert, the value at the beginning. Of the array okay. So if, I make use of. Unshipped. And. 67. So, what will happen this. Will insert, that 67. At the beginning, of the array so what is the latest array 21, and 43, so the 61, will be inserted, at the beginning, so that is this. Is going to be the new array, 67. 21, and 43, save, it and see. The output. 67. 21, and 43. Can you see this so, this is about, unshipped. And now. Then. We. Have to understand, there, is there are a few more things. Like this that is slice. And, splice. Okay. So. Shifting, elements, and shifting, elements, and changing, the elements. So. Changing, elements you know already if you want to change a particular element you, can directly. Use the index of that particular, element and change it that's that's absolutely fine. Deleting. Deleting. Is possible, but that actually. Don't delete, it I mean delete, only the value not the memory, so. That. Will be there in the memory as it is so, let us see what. This delete, will do, for. Example, delete. This, is the syntax delete. A or. Of, one. Okay. So. What. Is the point is it will delete the. Value 21. From the array. Because AR of one error of one is 20 when it will remove it but, it will still keep the space as it is it. Won't be it, won't edit. The array as 67, and 43, let us see this answer. Save. And, refresh. The, page you, will see this 67, and empty, you have empty, value as well as 43. So. This is what you had suppose it is not even space or empty, string or anything it is empty directly. Null it, is not null event it is completely. It is directly. Empty. Okay. Fine. So, whenever. If later, if you really, want to use AR of 1 is. Equal. To 99. Then. You, can see, the output like this. Let. Us see the output. So. The 99, got inserted at the air, of one so air of 1 is not removed, that, is still there air of one is not removed, and in the, place of 120, 43 is, not shifted, the, space for air of 1 is exactly. There as it is suppose. If I really want.
To Remove that element and, condense. This array, if you really want to do that then, you should not use. Delete. You have to use a. Function, called, splice. What. Is the name what. Is that splice, so, splice, works, like this ar. Dot. Splice. Of. Which. Index, you want to delete ok. From, which index, you want to delete ok, I want, to. Delete. From, one. Ok. How, many elements you want to delete I to delete only one element do. You want to insert anything no then. It will remove only one value at, this. Moment the, array. Values. Are. Come. On what. Are the values. 667. 99. And. 43. That's right so, it will remove 99. And. It. Will completely remove it the, center 99, will be removed and array will be condensed, okay let us see this output. You. See this 67. And. $43.99. Is completely. Removed out of the array, including. Its memory, also but, when you are, deleting, it it won't have it won't happen this. Is very very important, function that is called splice, very, many, times you may need to, use this, function called splice, understood. Sharad. Akansha. Delete. Reverse, reserves. The space here right yeah Dilli. Don't delete the space that will be there that. A of one is there forever. Okay. If you really want to insert later you can yeah. Akansha. Anything. Wants to you want to add it there. Okay. Fine. Is. It, clear akansha. Yes. Sir hello. Okay. Fine fine fine now. Let us go to the next concept. That, is, splice, is over, as, well as you can merge two arrays, these are all not complicated, you how to erase, and if you want to merge them and store in another array. That will be done with merging. Concat. Method does, not change, the existing, array it will always return, a new. Array it. Will, return. A newer. Concat. Concatenation. Will return a new array you can make three, arrays that is all possible. And slicing. Slicing, will. I, mean. Slice. From, a respect, to. Location. That means, for. Example here. If I say slice, one, from. One all the values will be sliced. This. Example slice out part of an array starting, from. Array. Orange let us see this, fruits. And let. Us implement, it and let us understand, what happens. So. If I want to see if, I see what is there in the. Citrus. Variable. Here. These. Fruits sliced. From, one. So. What. Will be there in the citrus you just, check it out. So.
Orange, Lemon, apple, and, mango, are there so from one the. Sliced, part, will be there in the in. The return value so banana will be removed and. Apart. From banana, whatever. There they will be stored, in the. Return. Value okay, like that, so. Slice, splice. Very, important, information. Now. Changing. From sliced. Changing. From. What. Is changing, from. Removing. A difference. Between slice and splice is very, much important, very much important, okay and now, if. You want to convert, an array, of elements into, a string, format that is also possible and that. Would be done by two, string. To. String, and. All. The values will be comma. Separated, let us see this is also really. Required, for us to. Really. Understand, the concept. So. Here, if I let, us take all these values. Console. Dot log of, citrus, now citrus, is giving me orange, lemon apple and mango but, still it is there. As an array. But. What happens if I store. Them, where. S. Is, equal, to. Citrus. Dot. Two. String. So. This is citrus, ra will be converted. Into a string, and that will be stored in the s, okay. That string is now with a comma separated variable so. Console, dot log of, s gives, you all, the values in a comma, separation, see this. Orange, lemon apple. And mango it is it is now a text, without. Any it. Is not an array now if, you check ok, it is not an array it is a string now it's completely, ok. And. Because. When, you want to send, the values from one end to another end, you. Need to, definitely convert. This entire array into strings string. Basically. Because. Some some, api's will accept, only string, data they don't accept, and JSON. Array or any. Array, format, some, of the API is or some of the servers, may really. Need the data in the text, format, or string. Format, in such cases you have to convert this entire, array into, string. Okay. Sometimes. API, is are your. Servers, gives you the data in this string, format, but. If you really want to. Manage. In the array format, then you can convert this string again, into an array so. Even for that we have, string. Functions. Okay. You just see this string, methods. So. String, method. Explode. There, is. There. Is a method, called. Yeah. So. Here we go that is we. Have a concept. Called. Split. We, have a function, called split. So, this split. Method, will. Divide. The entire, string. Into, an array. Of values. Okay. Let us see how to use this. Split. Let. Us see this so, I had to split this entire array, array. Is in the sorry if this string is separated. By comma, so I had to split it by comma, so. See this, where. Nu, a. R. Is, equal, to something some variable I have created, s. Dot. Split. Based. On a comma. So. Now if you see console, dot log of, new. Array. It. Will use you the Arabic. See. This this, is an array now this, is a string and this is an array now. Okay. If it is just a string you can't know, how many how. Many fruits, are there in that particular. Particular. String, okay. So you once, you. Split. It by using, comma, then. You will understand, how many. Apples. Are there so, like this you are going to have the. Key. You are going to have. The conversion, of a string, into an. Array. Okay. That's, about string. Into an array okay. Next. What. Is next. Come. On, so. Like that, array. Yeah. So. This. Ways we can make use of arrays. Array. Methods, even. Sorting, can be done in the arrays, okay. So. Sorting. Can be applied directly on, the array it. Will, you, have that array, sort methods, okay. So, just by saying. Sort, it will completely, sort the array in the, sorted order okay. When, it comes to the numeric, sort then, it is a, difficult. Case you have to understand, this numeric, sort properly. Because, it is also having a very very, important. Use. Case okay. Let us see how. Do you sort an array in, a, in a way so, what is a what. Is there in our air. Finally. Air is having, what. Forty-three. And sixty. Seven and forty three right okay. Let us first sort the normal. Fruits. Array so, whether it will be applied or not so, already, you have seen.
New. AR. Dot, sort. So. Automatically. Your new AR, will get sorted. And now if you print. What is there in the new air it, will, display the. New, sorted, list, of array see, here a apple, lemon, mango. And then or orange, this, array got converted, into this. Array because, of sort, function okay. Now. There, is one more function called what is that yeah the, same thing may not be. May. Not work with, normal. Numbers, number. Arrays okay. Let, us see let us first create the array. And then we will see this so. For that I will go, with another. Program a or of, three. Dot. HTM. So. Let us have this array, hmm. And apply. Them AR. Dot, sort. Will. It be sorted yes. It will sort. Console. Dot log of, AR. Print. The, sorted, array. Console. Dot log. Of. Air. Okay. Let us see the output, AR of three. So. This array got sort got. Converted, into this, array yes it, is in the sorted order now it is in the sorted order now okay. Fine. But it, is not the case every, time it's, not the case for every time imagine. Because. It. Is sorting, as. Still. SQL. Level. You'll, see this for, example if I have. Imagine. This is. 19. Oh sorry this is 19. And I have. 1. 0 1. What. Is a new sorted, order, what. Will be the array, after sorting. Come. On. After sorted what what is a new order you. Are supposed to get, 12. 19. 21. 143. And 1, 0, 1 this is, expected. Huh. Ah. Baby. What, happens, you know, the. Out pill will not be like this one not one will come in the beginning and then 12. 19. 21, 31, and 43, the, reason here, is it, is, one. Will be compared, with this one and then 0, in the. Second digit 2nd. Place which is the value I have. Which. Is the value I have 0. So, this we in consider, this one 0 is the minimum. Number it won't consider the next one okay. So when, it when, it is having different. Digits. In an array. Different. Digital, values, in an array. It. Won't sort it in a proper way so for that we have to make use of a sorting. In. A different way let us see so, you have to apply like this ok. So see. This how, I will do it it's, a big it's a little, it. Will call information. It. Will call a callback function in the callback function the. Values will be passed. And. B and we. Had to return a. Minus. B a. Minus. B. So, this. Particular fix, this, particular, fix will. Sort. The values in, a proper way console, dot log of air. You. See no twelve, nineteen, twenty, one thirty one forty three and one. Not one okay. This is just a fixed don't, think. Too much about it don't think too, much about it, console. Dot log of, a, comma. B, sir. What is a func what yeah what is that function doing, yes I will explain it don't worry it, will apply the. Yeah. Even I didn't get it on the very first moment, okay. So I just used it like that let us understand, what will be there in a and B. So. This a and. B. Will, carry this values. First, it will. Do. You remember sorting. The, types. Bubble. Sort merge, sort. Huh. Yeah. Those, those sorting techniques will be applied over here okay, yeah. Yeah, so, now as. Soon as you call this function what happens is. The. Function. This. This sort function call a callback function and. Which. Will pass the, values a and B. So. What are the values a and B this 19, and 21 will be passed. Okay. 21. And 19. Okay. No issues, 21. And a 9 in a is having. 21. And B is having 19, that's okay not, a big deal, then. Then. 21-19. If it is actually. Greater I mean if it is greater. Than 0 okay. If it is greater than 0, do. You mean by that. 21-19. Greater, than 0 means what. It. Is already in the sorted order so. They. Will not be. What. You say changed, its. Places. That. Will not be changed its places then. Then. 21. Will be compared, with. 43. 21. And 43, the values will be 21. And 4321. Will be there in the B and 43, will be there in the. But. A is 19, and B is 21, years of course. And, be all no. No no that. Is the that is the scenario. He. Is not 19, you never want to be have 19, yeah, we'll be having second, value and B, will be having first value that, is a that that is a logic. What they are using. In short. Function and I didn't write that short function right okay. So, that is how those. Values will be passed. Okay. So. Based, on the return value if if this a minus, B returns greater, than 0 then. Those values, will be sorted, if a minus, B into written the values 0 then. They will not be sorted, so, that is the logic which, is has been written in the short function we, are not writing the short form.
This. Is what I expected, so, blindly. Whenever, you have an numeric, array of. Whenever. You have an array of numeric. Values based on some numeric. Value you need to sort. The entire array you just blindly apply, this concept. Okay. Because what, is there inside the sort function no one knows okay, this is how we understood. And how, we are following. Our games. So. You, need, not worry you just follow this. Function. That's it you just write down that particular function, and a. Will be having the second. Value always and P will be having the first value, in the comparison, second next time a will. Have 43, and B will have, 21. In the, next time a. Will, be having 12 and may be. Okay. Because, it is. It. Is not greater, than 0. Because. 12 minus 43 will be minus. Right then. They, will be swapped. Actually. They will be swept this 12 will move to the, starting. In. Fact, okay. So. Then. 12. Will start, comparing with 19. And, then 21. So like that they they will. Roll. On this entire, array okay. So this is the structure what we are using for your sorting. An array. In. A numerical values. Even in my real time as scenarios, I have used it many, many, of the times many of the times okay. Like that we have to sort the arrays hope you understood, this concept okay. And then. We. Have to understand, how do we iterate. The arrays iteration, of the array see we. Have already done, the. Iteration, of the is through four, loops, okay. But. Tomorrow. What do we do is we are going to understand. Functions. Concept, functions, and then we will deeply. Discuss, about higher-order functions. And this, Map, Reduce. And all, so. Today this is it about. Handling. The arrays and array, functions, string, functions, how. Yeah yeah for each loop I will explain you how do we for, each loop in yes definitely. For. Under and understanding, that particular, for each loop you need to understand, functions. First functions. Higher-order. Functions. Callback. Functions, all these concepts, should be discussed. Okay so we, are discussing that tomorrow. Okay, callback. Functions, higher-order functions, under okay, that's, it guys that's it for today we, shall meet tomorrow for. The. Next. Level of topics, okay, akansha Sharad. Fine. Yeah go ahead Sharad, I am I'm, open, to questions I am very much open to questions, just. I don't want to load. More on, one. Day yeah yeah. Sharon. Tell me I. Will. Give you the recordings, buddy don't worry about if, you are not able to attend it I will share, the recordings, yaaaaa, we. Have, already the group I will be adding as soon as we have the payments and all so. You will get a blog. Okay. Yeah definitely. Definitely don't worry, try. To attend most, of the time yeah fine, fine fine fine okay.
Yeah. Okay. Okay Sharad, okay, akansha. Okay. See you see you see you soon see you tomorrow, bye-bye.