Help with JS Topic

To access an HTML element, JavaScript can use the document.getElementById(id) method.

The id attribute defines the HTML element. The innerHTML property defines the HTML content:


My First Web Page

My First Paragraph

What I’m confused about is what is a property?

Objects in javascript consist of properties. So when you call document.getElementById(id) it returns an Element object. The innerHTML is a property of that object.

Objects in Javascript consists of methods and properties. Any variable inside an object is property if it isn’t a function. Functions inside an object are called methods.

let obj = {
    name: "Some One",
    sayHello: function() {
         // some fancy code
         return ;

Here, name is obj's property, while sayHello is a method.