Hello in this video I am going to show you the void operator so the void operator you know you attach it to some sort of function and it returns you know undefined my wondering why would you want it to return undefined sometimes you require that result if you want to you know perform some code and you need to have a return of undefined void is the great is the route to go Okay, so let's create a little two Should we do should we do? Yeah, let's just create a quick one on click. Let's say call is void. Void reserved keyword so we can call it void funk. To calculate and call it void and here will be Put, so what you do you do void function, then your function name. So it's void form, open close bracket, curly braces, just one thing because they see like an operator method yet another, that'll be closing brackets and a semicolon here.
You can put it all on one line, but this alone, nothing better like this. So let's see what happens. So for the console dot log, like so. And we do, do you know what, I'm not going to do it on click. I'm not going to do it on click at all. So I'm actually gonna remove that.
I'm going to take this will take you to this fall. And I'm actually going to manually call a functional cell phone gonna say From the console log in to say, hi. So reload says hi where it says uncaught reference error void funk is not defined. So even though void funk is actually defined here, because we put the keywords of Africa rid of that extra little bit missing, oh, there we go. So if you know, you want to be able to run some piece of code, but then you need a response that says undefined. You know, you may need that proof of error checking using some sort of try catch block, then the void operator is the way to go.
That's it for this video. If you have any questions, feel free to pop me a message and I look forward to seeing you in the next video.