01 - JavaScript - Basic Understanding

01 - JavaScript - Basic Understanding

JavaScript is a high-level, object-oriented programming language used to create interactive web pages and web applications. It was first introduced in 1995 and has since become one of the most widely used programming languages. JavaScript runs on the client side, meaning that it is executed by the user's web browser, rather than on a web server. It can be used to add dynamic effects, animations, and interactivity to a website. Additionally, JavaScript can be used on the server side, using technologies such as Node.js. With its versatility and widespread adoption, JavaScript has become an essential tool for web developers.

JavaScript Keywords

In this section, we are going to see some of the most common keywords which are used in JavaScript and these keywords can be found in most web application codes.

  1. "var" - It is used for declaring a variable.

  2. "let" - It is used for declaring a block variable.

  3. "const" - It is used for declaring a block constant.

  4. "function" - It is used for declaring a function.

  5. "return" - It is used for exiting a function.

  6. "try-catch" - It is used for handling errors in a block of statements.

  7. "for" - It is used for running a block of statements in a loop.

  8. "if" - It is used for running a block of statements on a condition.

  9. "switch" - It is used for running a block of statements on different cases.

JavaScript Syntax

In this section, we are going to see and code most of the commonly used JS syntax which would help in web development.

  • JavaScript Variables - variables are used for storing data values, which can be constant values or variable values. The JavaScript keywords which help in creating variables are var, let and const. We use the assignment operator ( = ) for assigning values to the variables.

      // Declaring a var variable
      var a = 9;
      // Declaring a let variable
      let b = 10;
      // Declaring a const variable
      const c = 11;
    
  • JavaScript Operators - In JS, we commonly use mathematical symbols for evaluating an expression. These are +, -, / and * which are used for addition, subtraction, division and multiplication respectively.

      var d;
      d = a + (c - b) / a;
    
  • JavaScript Comments - In JS, we use // (single-line) or /* between data is commented */ ( multi-line ) for commenting.

      // This is a single line comment
      /* 
          This is a multi line comment - line 1
          This is a multi line comment - line 2
      */
    

Finishing Up

Thank you for reading my article! I hope this has given you some insight into some of the basics of JavaScript. In the next part, we would explore some of the JavaScript Variables.

Did you find this article valuable?

Support manas krishna jaiswal by becoming a sponsor. Any amount is appreciated!