<html>
<body>
<h2>JavaScript Class Static Methods</h2>
<p>To use the "mycar" object inside the static method, you can send it as parameter.</p>
<p id="demo"></p>
<script>
class Car {
constructor(brand) {
this.carname = brand;
}
static hello(x) {
return "Hello " + x.carname;
}
}
mycar = new Car("Ford");
document.getElementById("demo").innerHTML = Car.hello(mycar);
</script>
</body>
</html>