• WEBVTT This you are going to be going over some of the other cool features that maybe we've talked about here and there may be not what we might see some new things here but overall we'll just kind of expand our knowledge of some of these nice features. So the first one I want to touch on is the spread syntax which we have actually seen before. So the spread syntax can basically be used to take multiple arguments and condense them into an array for example. So let me add that in comments slash can be used in places where functions and in e.g. e.g. functions expect multiple arguments. So as a reminder of that let's do a quick one year function call it spread function and if you do something like dot dot dot and then you can learn Java Coding From Digital Marketing agencies in Bangalore give you know multiple args and it's basically no matter how many arguments you give it because we're using the spread operator here is basically in a condensed them down into one array. So as an example we'll just cancel log out whatever we give this console adult log multiple args. There were some dropping off the spread syntax from the front because you only really need this in the parameters of the function. And then here Digital Marketing Agencies in Bangalore if I invoke the function spread function I will give it a number. We'll give it another number we'll give it a boolean we'll give it a string.


    Give it another string could use as many arguments as we need here and we don't need to make sure that we have a certain set in our function arguments because we have this spread operator as you see here Digital Marketing Agencies in Bangalore it kind of condensed it down into an array. And this can actually be used not just for arguments but also for multiple elements. Or even multiple variables. So we've seen this a couple of times right in our function parameters. But what if we wanted to do something else with the spread syntax what would that look like. Well let's say we have an array supports my array and we have a couple of numbers. So this is iterable which means we can use the spread syntax with it. So what can we do with this? Well, let's try to Digital Marketing Services in Bangalore. I thought of my array. It's not really going to look any different. It just logs out each element in the array. But works a little different than you might expect. Right because we use the dot dot dot here. So we're kind of iterating over it. If I remove that it just displays them in an array. So that kind of gives us a hint as to what we can do with this. So you know what let's say we have this array and we want to take this first array and we have another cost my second array.


    And this one has other numbers. For example, let's say you want to take the first array and somehow put it into the second array. Of course, we could do something like that. My second array pushes my array. This will definitely work at this point if we can still log my second array. Let's take a quick peek at it. So it added it but it concatenated the array into the array. It's not quite the behavior we expected. Right. Or maybe you did. If you did. That's awesome. But in any case, this is a little list of Digital Marketing Agencies in Bangalore So we have one two three four five six elements in the array and one of them one of the elements is actually an array instead of a number like the rest of our array. Well, recall when a console logs dot dot dot Mirei that's kind of our hint as to how we can use the spread syntax in that regard. So let's say instead of doing it that way we do something like this Konst my third array. OK, we're going to create an array and we're going to Show Digital Marketing Agencies in Bangalore. My array k. And then let's also do dot dot dot. My second array. Let's see what happens if we can solve that.


    My third array clear that run it well isn't that interesting. So I like to kind of think of this as you know we're sort of making a copy or cloning the original. But hey this is working pretty nicely right. We could have also just done something with the numbers. Whoops, I wanted your comments coma. Five six seven eight nine ten. We could definitely do that. That work in pretty much the same way. Right we're just kind of iterating using the spread syntax and taking each of these items and placing them into this third array so very easy to use with array literals like this. What if you did want to use push through. Well, let's see how we can do that. So let's move down a little bit. I'll move this over some space. Now there is a way that you can use an array as if it weren't an array.


    And what I mean by that is we can do something like this function. Say hello. For example, I know I'm not the most descriptive name but it takes three arguments and it's just going to say cancel that log use back to x. Hello, x y z. Just doing some simple interpellation. Now let's say we have Digital Marketing agencies in Bangalore array and we want to use the array in this function. Well, our function is not expecting an array. It's expecting three separate arguments essentially. But just for the sake of this example let's try that. So we say Conte's Hello. Array equals an array literal will just be. Hello Bob. We'll just see some names here Bob. Jane and Peter. Now of course if we try to invoke say hello and pass it the array Hello array