Please login to start chat

ICT Solutions 22 Jun 2022, 08:02:28
Category : JavaScript Tutorials

Creating Object (JS Classes)

<!DOCTYPE html>
<html>
<head>
<title>JavaScript Code Testing</title>
</head>
<body>
<p id ="demo"></p>
<script>
class Name{
constructor(Name, City){
this.name = Name;
this.city = City;
}
}

var newName = new Name("Thet", "Yangon");
document.getElementById("demo").innerHTML = newName.name + " stays in " + newName.city + ".";

</script>
</body>
</html>

Comments:

No comment to show.

Available Services
Download Android Application