Introduction To JavaScript (JS) Programming

Must read

EquickLearninghttps://www.equicklearning.com
I’m Anuj Dwivedi & I’m Studying Computer Science & Engineering Course. My age of 20 years. I belong to district Pratapgarh, Uttar Pradesh in India. I’m Share Basic and Professional Knowledge of Computer Science & Technology Related information. People and Student who are a beginner in Computer Technology they can follow my website Step by Step I always help him.

JavaScript Programming:- JavaScript abbreviated as JS is a programming language. JavaScript is a robust and an interactive language.

Introduction To JavaScript Programming

 Shopper-Facet Scripting : means all the things on the net utility web page out there on the person’s finish. 

Server-Facet Scripting : means all the things on the net utility  web page out there on the server finish. 

Methods so as to add JS Programming in your file:

  1. Inside JS : This sort is used anyplace contained in the HTML file utilizing <script> tag.
  2. Exterior JS : This sort of JS is used outdoors the HTML file by making a .js extension file and including the JavaScript code inside it. It’s added within the HTML file utilizing src attribute and script tag. 

इसे जरुर पढे – Variable क्या होता है? । What is Variable in Hindi?

Syntax:

JS code is inserted in between the <script> & </script> tag. 

At all times add a semicolon ( ; ) on the finish of each JS operate code.

<script>
   JavaScript code
</script>

Let’s print a primary code in JS- Hi there World! utilizing doc.write(): 

Embed JS:

<!DOCTYPE html> 
     <html> 
        <head>
          <title>
             Introduction To JavaScript 
          </title> 
        </head>          
        <physique> 
           <script>
              doc.write("Hi there World!");
           </script>
        </physique>
     </html>

Output:

Introduction To JavaScript Programming

Exterior JS:

index.html

<!DOCTYPE html> 
     <html> 
                <head>
                        <title>
                            Exterior JS 
                        </title> 
                        <script src="http://www.techychefs.com/2021/02/script.js" sort="script/js">
                </head>          
                <physique> 
                </physique>
     </html>

script.js

          doc.write(“Welcome to JS!”);

Introduction To JavaScript Programming

 

Remark in JS Programming:

<script>
  //This can be a single line remark
  doc.write("Hi there World!");
  /* This can be a multiline remark  It might probably consist of two or extra strains */
  </script>

Knowledge sorts & Variables in JS Programming:

  • JavaScript variables are containers for storing information values.
  • Knowledge sort is a sort of information any variable can maintain.
  • The next information sorts are utilized in JavaScript:
Introduction To JavaScript Programming

Also Read This- FAT32 and NTFS file system in Hindi | What is File System?

Primitive Knowledge Varieties: 

They’re the frequent information sorts in JS.

var is used to declare primitive datatypes in JavaScript.

Click Here For More Go Programming Language क्या है?

  1. Quantity – This datatype may be an Integer, Floating worth, Exponential worth or Infinity. Used to carry out Arithmetic operations (+,-,*,/,%). 
    • Ex: var x = 4 ; //integer worth
    • var y = 23.78; //decimal or floating level worth
    • var z = 10e6; //this implies 10 raised to the ability of 6
  2. String – Any info written utilizing single or double quotes in JavaScript is known as a String. Instance: Identify, Tackle, and many others
    • Ex: var identify = “Ravi” ; 
    • var metropolis = ‘Mumbai’ ; 
  3. Boolean – This datatype has solely 2 values – true & false. It’s used to examine a logical situation or comparability operations.
    • var a = 15; 
    • var b = 10;
    • (a>b)
  4. Null – In JS null means nothing in worth. When an worth doesn’t exist it may be outlined as null. 
    • var identify = “Simran”;
    • identify = null;

       Which means the worth is null however identify continues to be an object. 

  • Undefined – In JS any variable that exists with no worth is known as undefined variable. 

            This returns the worth of variable e-mail as undefined.

            The worth in addition to the kind each are undefined.

Learn Here : EquickLearning – What is Java

Composite Knowledge Varieties: 

  • Object –  In JavaScript all the information sorts are objects ie. Boolean, string, numbers, and many others. Objects are variables that accommodates a number of values.  
  • Arrays – An array is a sort of object variable which has the aptitude of holding a number of values in a single array. Array holds keyed assortment of values. 
    • There are two syntaxes for creating an empty.
    1.  arr = new Array();
    2. arr = [] ; 
  • Let’s create a brand new array of greens utilizing the second syntax
    • var veges = [“Potato”, “Tomato”, “Carrot”, “Cucumber” , “Onion”];

These components within the array are accessed utilizing the important thing numbers ranging from zero for the primary factor and so forth. 

We are able to get any factor in an array utilizing sq. brackets. 

for (i=0;i<veges.size;i++)  
doc.write(veges[i] + "<br>");  

                           

Output

  • Potato
  • Tomato
  • Carrot
  • Cucumber
  • Onion
  • Features – These are utilized in JavaScript to carry out operations. They can be utilized a number of instances in the identical code. With the assistance of features we do not have have to put in writing many strains of code to carry out any specific job frequent to this operate. We are able to name the operate to carry out any job. 
    • operate fname(arg1, arg2, …)

                operate code to be executed

Instance: 

operate AddValues(a,b)

    doc.write(“Consequence: ” + (a+b));

AddValues(18, 39);

Output:

Consequence: 57

JavaScript operators are symbols which are used to assign values, evaluate values, carry out arithmetic operations and extra. 

Operators

 

Arithmetic operators:

Performs mathematical operations on numbers.

Arithmetic Operators Introduction To JavaScript Programming

Comparability operators:

Performs mathematical operations on numbers.

Are used to check for TRUE or FALSE.

Utilized in logical statements to find out equality or distinction between values.

Comparison Operators Introduction To JavaScript Programming

Logical operators:

Are used to check for TRUE or FALSE.
Used to find out logic between values.

Logical Operators Introduction To JavaScript Programming

Bitwise operators:

Works on 32 bits numbers. 
Any numeric operand within the operation is transformed right into a 32 bit quantity.
The result’s transformed again to a JavaScript quantity.

Bitwise Operators Introduction To JavaScript Programming

Task operators:

Assign values to JavaScript variables.

Assignment Operators Introduction To JavaScript Programming

String operators:

Used to find out sort of information being saved in a variable.

String operators: Introduction To JavaScript Programming

Typeof operators:

Used to find out sort of information being saved in a variable.

 Introduction To JavaScript Programming

Glad Studying!!

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

x