JAVASCRIPT
Tags: javascript, webdev, programming, beginners
Published: 2023-09-04 04:19:08

* JavaScript was build in 1995 by Brendan Eich

* JavaScript is a extra-ordinary just in time complied programming language that confirms to ECMAScript Specification.

* JavaScript close at hand HTML and CSS is one of the core technologies of the world wide web.

* JavaScript can be used to build server side applications.

* JavaScript is the most Popular programming language according to the 2022 stack overflow developer survey.

**Two ways of implementation of JavaScript in HTML** 
1. Inpage Javascript
2. External javascript
```<html>
     <head>
          <script>
          </script>
     </head>
     <body>
        <h1>Inpage Javascript</h1>
      <script></script>
     </body>
</html>

*Second is external JavaScript helps to connect js file with html file, if file name is content.js,  it will be insert html as
<html>
     <head>
          <script src="content.js"></script>
     </head>
     <body>
     </body>
</html> ``````


**What are the comments in Javascript ?**
There are Two types of comments.
1. Single line comment
2. Multiple line comment 

commented code will stay in code but wont its like body without live.

if your any single line of code is useless you can comment it with two  slash // 
for example 
 ```<body>
      //<h1>Inpage Javascript</h1>
 </body>```

And if your code is than more 1 line, you can comment it with slash and star /* from start till end of code
for example
 
```<body>
      /*<h1>i am double line code</h1>
        <div>hello world </div>
        <div>hello coders</div>*/
</body>```

**what are the variables ? in JavaScript and what are its types?**

A JavaScript variable is simply a name of storage location.     There are two types of variables in JavaScript.
* local variable and 
* global variable.

**Variables are Declares in 3 Types**
1.Var (Global scope)
2.let (Block scope)
3.Const (Block scope)

global scope has access to work anywhere in program, But block scope only works inside the { curly brackets}.

```if(condition){        if(condition){          if(condition){
var a="hello world"     var a="hello world"      var a="hello world"
}                         console.log(a)           console.log(a)        
console.log(a)           }                         } ```

**What are the Data Types in Javascript ?**
1. String  (if data is inside "Quotes"),
2. Number (if data is a 1,2,3 number),
3. Boolean (if data is true or false),
4. Array (if data is inside [ square bracket ]),
5. Object (if data if under {curly bracket}),
6. Null (if data is null),
7. Undefined (no data).

**what are the Arithmetic Operators in javascript and its uses ?**
1. + (plus sign) used for addition purpose.
2. - (minus sign) used for subtraction of values.
3. * (star sign) used for multiplication.
4. ** (2 star sign) used for exponentiation.
5. / (slash sign) used for division.
6. % (percentage sign) for modulus remainder.
7. ++ (2 plus sign) used for increment.
8. -- (2 minus sign) used for decrement. 

**and there are also an Assignment Operator and Comparison Operators**

this are the Assignment Operator given below
1. = 
2. +=
3. -=
4. *=
5. /=
6. %=
7. **=

Now Lets check the Comparison Operator's Below
1. == (2 equal to) must have same value.
2. === (3 equal to) must have same value and same data type.
3. != (xcalamtion and equal) shows not equal value.
4. !== (xclamation and 2equal) not equal value or not equal type.
5. > (greater than)
6. < (Lesser than)
7. >=  (greater than or equal to)
8. <= (Lesser than or equal to)