I am so confused about the function property and class property

Function is one type of object.

function Person(first, last, age, eye) {
this.firstName = first;
this.lastName = last;
this.age = age;
this.eyeColor = eye;

“this” refers to the Person. Then “This.firstName” is the property of function Person.

class Car {
constructor(name, year) {
this.name = name;
this.year = year;

The example above creates a class named “Car”.

The class has two initial properties: “name” and “year”.


I have the following question.


class Calculator {

constructor(previousOperandTextElement, currentOperandTextElement) {

this.previousOperandTextElement = previousOperandTextElement

this.currentOperandTextElement = currentOperandTextElement



clear() {

**this.currentOperand** = ''

this.previousOperand = ''

this.operation = undefined


My question is:

whether “this.currentOperand” is the property of the “clear()” or the property of the “class Calculator”??

It would be a property of the class

Would you mind giving a simplification?

A simplification of what?

i think he meant ‘explanation’

Than you for your response. I mean an explanation of why “this.currentOperand” would be a property of the class.

Why do you think it would be a property of the method?

I would have believed “this.currentOperand” is a property of class. But methods are regarded as a type of function like function Person. Then, “this” can also refer the function identifier such as Person. So I felt complex.