this written in white lettering on dark weathered wood

This Keyword

In JavaScript functions, you will see the special “this” keyword used. Let’s see it in an example…

let animal = {
    animalName: ‘Bongo’,
    getName: function(){
        return this.animalName;
    }
};
console.log(animal.getName());

The “this” keyword refers to the object itself. You will see this in object function properties often.

Happy Coding!

Clay Hess

Share this post

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on pinterest
Share on print
Share on email
Skip to content