Hello, in this JavaScript video I'm going to show you the function constructor. So don't mistake this for a constructor that you can have in a class this is you know, something different, but this is similar to an anonymous function or an arrow function. And what you can do is we'll just modify this. So, instead of having a diff format up here, you can see the different properties that are true for example. And instead of doing you know, if you do new country key word, so you can name it again, it's still assigned to a variable and instead of having all this or scheduled beforehand, what you do is open closed where the brackets per semi colon and here you pass in your function body so you know any code that you put between curly braces, braces, and any arguments Firstly, point arguments. You can find them Many of you want the last parameter passed in, where is one parameter or reply parameter, then it will be the fifth one in the actual function body.
So today the function body, put quotation marks in the function body itself. So, console dot log. Hello, well save that, run it. And obviously I want to do, I'll say hello, we'll build up our printf function constructor instead. So we can see the difference. Epic Vol.
One, there we go. Let's see what we get. We get function constructor. So this works just the same way as well. So if you want to pass in parameters, you pass them in beforehand. So let's say four and a pass in x and y, and in here, maybe I multiply them together.
I'm using single quotation marks instead of double here, because they would complete with these double, and they will start opening and closing, just make sure if you use a single use double here, and you know vice versa. Instead if I want to do x multiplied by y, so this isn't actually a string necessarily, the code that we want to run for right is not defined, I have not kept them not defined at my bed, I need to, I need to close these in quotation marks. Well, night I run it, there we go, we get x times one is because they're in single quotation marks that detect the other string inside that there we go, we get 13. So that's the function constructor. And that's a novel way of writing functions. Well, thanks for watching.
If you have any questions, feel free to pop me a message. And as usual, I look forward to seeing you in the next video.