JavaScript Class
HTML CODE:
<html>
<head>
<script type="text/javascript" src="classinjs.js">
</script>
</head>
<body>
This for the class and object example in javascript->
</body>
</html>
JAVASCRIPT CODE:
class std
{
constructor(fname,lname)
{
this.fristname = fname;//it will call the function variable
this.lastname = lname;
var fullname = fristname + lastname;
alert(fullname);
}
var register = new std('coimbatore','cbe');
SCREENSHOTS:
<html>
<head>
<script type="text/javascript" src="classinjs.js">
</script>
</head>
<body>
This for the class and object example in javascript->
</body>
</html>
JAVASCRIPT CODE:
class std
{
constructor(fname,lname)
{
this.fristname = fname;//it will call the function variable
this.lastname = lname;
var fullname = fristname + lastname;
alert(fullname);
}
var register = new std('coimbatore','cbe');
SCREENSHOTS:
Comments
Post a Comment