<!DOCTYPE html>
<html lang="en">
<head>
<title>latihan 2 Objek</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script type="text/javascript">
function timeObjc(hour,minute,second){
this.hour= hour;
this.minute = minute;
this.second= second;
this.setTime= function(whathour,whatminute,whatscnd){
this.hour=whathour;
this.minute =whatminute;
this.second =whatscnd;
};
this.runTime = function(){return this.hour+":"+this.minute+":"+this.second};
}
timeObjc.setTime(10,22,36);
timeObjc.runTime();
</script>
</body>
</html>
i want to set the time manually outside the function and print it with the runTime functio, but it keep error that said "setTime is not a function".. i would be grateful to know wht i'm missing and why is it happening. thanks in advance