write using class return this greeting
<html>
<head>
<title> write function with class return and this </title>
<script>
class Greeting
{
ourMessage()
{
return "Hi Everyone";
}
showOurMessage()
{
document.write(this.ourMessage());
}
}
let myGreeting = new Greeting();
</script>
</head>
<body onload="myGreeting.showOurMessage();">
</body>
</html>
<head>
<title> write function with class return and this </title>
<script>
class Greeting
{
ourMessage()
{
return "Hi Everyone";
}
showOurMessage()
{
document.write(this.ourMessage());
}
}
let myGreeting = new Greeting();
</script>
</head>
<body onload="myGreeting.showOurMessage();">
</body>
</html>