Quiz on Working with Classes

Test your knowledge of classes by taking the following quiz.

1

What will the output of the following code be?

class Tax {  
  static forAmount(amount) {
    return amount * Tax.stateRate;
  }
}
Tax.stateRate = '.08';
const forAmount = Tax.forAmount;
this.stateRate = 0.01;
console.log(forAmount.call(this, 100));
A)

1

B)

8

C)

NaN

Question 1 of 50 attempted

Get hands-on with 1200+ tech skills courses.