Code

General Code

Apply

The “apply” method to run a function is similar to “call”. The difference is that with “apply”, we can pass arguments to the function for the new context. Here is an example… Notice that here we are passing an array of arguments. In this case, it is a simple string. We also altered our function […]

Apply Read More »

Call

There are some different ways to run a function rather than the traditional way. One of them is by using “call”. The advantages of “call” is it changes the scope of “this”. Here is an example… The output would be “George”. By using “call” and passing new data, we are shifting the “this” reference to

Call Read More »

This Keyword

In JavaScript functions, you will see the special “this” keyword used. Let’s see it in an example… The “this” keyword refers to the object itself. You will see this in object function properties often. Happy Coding! Clay Hess

This Keyword Read More »