Đối tượng (object) Chi Tiết Nhất Trong JavaScript SinhVienCNTT.Net

Đối tượng (object) Chi Tiết Nhất Trong JavaScript SinhVienCNTT.Net

by sinhviencntt

HTML

<!DOCTYPE html>
<html>
<body>

<h1>
Đối tượng (object) Chi Tiết Nhất Trong JavaScript SinhVienCNTT.Net
</h1>

<p id="demo"></p>

<script>
var maySo1 = {
    tenMayTinh:"Máy Số 1", 
    nhanHieu:"DELL", 
    RAM:"8Gb",
    tinhTien: function(thoiGian, donGia) {
    	var soTien = thoiGian * donGia
    	return soTien;
    }
};
document.getElementById("demo").innerHTML =
maySo1.tenMayTinh + ": " + maySo1.tinhTien(5, 5000) + " VNĐ";
</script>

</body>
</html>