Home | Computer Science
write a programme using function();

<html>

<head><title>javascript</title>

<script>

function vardeclaration(){

let a;

a=24;

document.getElementById("demo").innerHTML=a;
}
</script>

</head>

<body>

<button onclick="vardeclaration()">click on me</button>
<p id="demo"></p>
</body>

</html>

output:-

 Write a programme using function();

<html>

<head>

<title>javascript</title>

<script>

function hello(){

let a,b,c,d,e,f;

a=12;

b=3.5;

c=44;

d=a*b*c;

e=44.5;

f=74.5/5*a+d;

document.write(d+"<br>"+e+"<br>"+f);

}

document.getElementById("d").innerHTML=hello();

</script>

<p id="d"></p>

OUTPUT

1848

44.5

2026.8