0% found this document useful (0 votes)
34 views1 page

JavaScript Class and Object Example

Uploaded by

Thora Lim
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views1 page

JavaScript Class and Object Example

Uploaded by

Thora Lim
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

<!

DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Class & Object</title>
</head>
<body>
<script>
class Car{
constructor(make, year) {
[Link] = make;
[Link] = year;
}

getMake() {
return [Link];
}
setMake(make) {
[Link] = make;
}
}
const car = new Car("Toyata", 2020);
// [Link](car);

[Link]("Make: " + [Link]);


[Link]("<br>");
[Link]("Year: " + [Link])

[Link]("BMW");
[Link]("<br>After update \n");
[Link]("Make: " + [Link]());
</script>

</body>
</html>

You might also like