Professional Documents
Culture Documents
Javascript Function
Javascript Function
DOCTYPE html>
<html>
<body>
<h2>date function</h2>
<button type="button"
onclick="document.getElementById('mohan').innerHTML = Date()">
<p id="mohan"></p>
</body>
</html>
• Automatically
• Using var
• Using let
• Using const
<!DOCTYPE html>
<html>
<body>
<script>
x = 5;
y = 6;
z = x + y;
document.getElementById("mohan").innerHTML =
</script>
</body>
</html>
<script>
let x = 5;
let y = 6;
let z = x + y;
document.getElementById("mohan").innerHTML =
</script>
Function
<!DOCTYPE html>
<html>
<body>
<h1>techinate function</h1>
<p>Call a function which performs a calculation and returns the result:</p>
<p id="mohan"></p>
<script>
return p1 * p2;
document.getElementById("mohan").innerHTML = result;
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h1>techinate function</h1>
<p id="mohan"></p>
<script>
function myFunction(a, b) {
return a * b;
</script>
</body>
</html>