HTML-Intro-and-JavaScript-Basics

  1. Assignment Operator (=):

    • var1 = 3; assigns the value 3 to the variable var1.
    • var2 = 4; assigns the value 4 to the variable var2.
    • var1 = var1 + 7; adds 7 to the current value of var1 and updates the value of var1 to the result, which is 10.
  2. Inequality Operator (!=):

    • var1 != 10 checks if the value of var1 is not equal to 10. In this case, it evaluates to true because var1 is indeed not equal to 10.
  3. Mathematical Operators (+, -, sqrt, ceil):

    • var1 + 7 adds 7 to the value of var1, resulting in 10.
    • Math.sqrt(var1) calculates the square root of var1, which is approximately 3.162.
    • Math.ceil(Math.sqrt(var1)) calculates the ceiling value of the square root of var1. In this case, it rounds up 3.162 to 4.
  4. Logical Operator (&&):

    • Although the code provided does not include the logical AND operator (&&), it's a fundamental operator in JavaScript used for combining conditions in logical expressions.

The code also includes HTML and JavaScript to display the value of the first paragraph on the web page in the console. It demonstrates the use of the getElementsByTagName method to access HTML elements and log their content to the console when the page loads.

This code is a simple introduction to some of the core JavaScript operators and their application within a basic web page. It's a starting point for those learning JavaScript and web development.