need of today

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Writing into the browser console

<!DOCTYPE html>
<html>
<body>
<h2>Activate Debugging</h2>
<p>F12 on your keyboard will activate debugging.</p>
<p>Then select "Console" in the debugger menu.</p>
<p>Then click Run again.</p>
<script>
console.log(5 + 6);
</script>
</body>
</html>
4. JavaScript Syntax
 JavaScript statements
 JavaScript numbers
 JavaScript strings
 JavaScript variables
 JavaScript operators
 JavaScript assignment
 JavaScript expressions (using constants)
 JavaScript expressions (using strings)
 JavaScript expressions (using variables)
 JavaScript keywords
 JavaScript comments
 JavaScript is case sensitive

JavaScript statements

<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Statements</h2>
<p>A <b>JavaScript program</b> is a list of <b>statements</b> to
be executed by a computer.</p>
<p id="demo"></p>
<script>
var x, y, z; // Declare 3 variables
x = 5; // Assign the value 5 to x
y = 6; // Assign the value 6 to y
z = x + y; // Assign the sum of x and y to z
document.getElementById("demo").innerHTML =
"The value of z is " + z + ".";
</script>
</body>
</html>

JavaScript numbers

<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Numbers</h2>
<p>Number can be written with or without decimals.</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = 10.50;
</script>
</body>
</html>

You might also like