Lab 3
Lab 3
JavaScript Values
In JavaScript, you can have two types of values.
JavaScript Literals
In the below code, 20 is a Number literal and ‘Helloworld
’ is a string literal.
<html>
<body>
<script>
document.write(20); // Number Literal
document.write("<br />"); // To add line-break
document.write("Helloworld"); // String Literal
</script>
</body>
</html>
JavaScript Variables
In JavaScript, variables are used to store the dynamic data.
var
let
const
<html>
<body>
<scprit>
Function getsum(first,second){
Let first = 3;
Getsum(first ,second);
</scprit>
</body>
</html>
<script>
// Accessing the document object
const headingElement = document.getElementById('heading');