Hello, in this JavaScript video, I'm going to show you the static keyword. And we're going to use it to create a static function versus static function static function on like any other function set function like a million times in the last 10 seconds is one that doesn't require an object of the class to be created to be able to access it like you know, it does, right? Yeah. So if, for example, I just use the name of the class, or do dot epic fun. Save that run it, we get an error. Fifth quarter epic font is not a function.
And that's because epic fun needs to have an object created. Whereas if I create a number function, and to create static function, to static, don't call it that take fun. And again, as with any other function, as I covered in the following video of this series, you can add parameters in there, you can do return statements, all that stuff. So simple to do a console log. Yeah. This is epically static.
And now we'll replace that with static fine. And I run it. As you can see, this is epically static. And that's what a static function is. It does not require an object to be created. So if I literally delete all these lines of code, reload, as you can see still works.
Or bigger class, we haven't created an instance of it in the form of an object, it's going up into this. But we're starting to access it. So if let's say you have some functionality that's linked with what your class is, but you want it to be accessible, you know, anywhere really without having to create an audience. git commit, this is the way to go, you use a static function. Thanks for watching. If you have any questions, feel free to pop me a message and I'll lend your hand and as usual, I look forward to seeing you in the next static video.