Static Properties in JavaScript

Static properties are assigned to the class function itself and not to its prototype property. These properties can be called directly without instantiating any objects.

Following is the code for static properties in JavaScript −


 Live Demo

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
   body {
      font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
   .result {
      font-size: 20px;
      font-weight: 500;
      color: blueviolet;
<h1>Static Properties in JavaScript</h1>
<div class="result"></div>
<button class="Btn">CLICK HERE</button>
<h3>Click on the above button to the access the static property school of Student</h3>
   let resEle = document.querySelector(".result");
   function Student(name, age) { = name;
      this.age = age;
   } = "St Marks Public School";
   document.querySelector(".Btn").addEventListener("click", () => {
      resEle.innerHTML = " = " +;


On clicking the ‘CLICK HERE’ button −