10 important basic topics in JavaScript
1. JavaScript Operators :
JavaScript is an interpreted language. There are some types of operators. These are-
*Arithmetic Operators: Arithmetic Operators are Addition(+), Subtraction(-),Multiplication(*),Division(/),Modulus(%),Increment(++),Decrement(- -).
*Comparison Operators: Comparison Operators are Equal(==),Not Equal(!=),Greater than(>),Less than(<),Greater than or Equal to(>=),Less than or Equal to(<=).
*Logical Operators: Logical Operators are Logical AND(&&), Logical NOT(!), LogicalOR(||).
*Bitwise Operators: Bitwise operators are Bitwise AND(&),(BitWise OR), Bitwise XOR(^),Bitwise Not(~),Left Shift(<<),Right Shift(>>),Right shift with Zero(>>>).
*Assignment Operators: Assignment Operators are Simple Assignment(=), Add and Assignment(+=),Subtract and Assignment(-=),Multiply and Assignment(*=),Divide and Assignment(/=),Modules Assignment(%=).
*Conditional Operators: Conditional Operators are Conditional(?:).
2. JavaScript If…Else :
If a program of Conditions is true then inside work in the program, else not
working inside the program. The following flow chart shows how the if-else statement works.
JavaScript supports the following forms of if..else statement −
- if statement
- if…else statement
- if…else if… statement.
3. JavaScript-While Loops :
While loop is to execute a statement or code block repeatedly as long as an expression is true. Then the expression becomes false, the loop terminates. The flow chart of the while loop looks as follows −
4. JavaScript-For Loop :
The for loop is the most important loop in javaScript.It includes three
parts. Parts are loop initialization, test statement, and iteration statement. Three parts in a single line separated by semicolons. The flow chart of a for loop in JavaScript would be as follows −
5. JavaScript — Loop Control :
JavaScript loop controls are break and continue statements. These statements are used to immediately come out of any loop or to start the next iteration of any loop respectively. The flow chart of a break statement would look as follows −
The continue statement is the interpreter to immediately start the next iteration of the loop and skip the remaining code block.
6. JavaScript Functions :
A function is a group of again use of code that can be called anywhere in the program. Then the need of writing the same code again and again. It helps programmers in writing modular codes. Functions allow a programmer to divide a big program into several small and manageable functions. The basic syntax is shown here.
7. JavaScript Arrays :
The array stores multiple dates in a single variable. It stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a
collection of variables of the same type. Use the following syntax to create an Array object −
8. JavaScript Number :
The Number represents the numerical date, either integers or floating-point numbers. There are some properties in javaScript
Number. These are -
* Number.MAX_VALUE: The largest positive representable number.
* Number.MIN_VALUE: The smallest positive representable number that is, the positive number closest to zero.
*Number.NaN: Special “Not a Number” value.
9. JavaScript Math :
Math properties and methods are mathematical constants and functions.
The properties and methods of Math are static and can be called by using Math as an object without creating it. There are some methods in
JavaScript Math. These are -
* abs(): Returns the absolute value of a number or no negative number.
* ceil(): Returns the smallest integer greater than or equal to a number.
* floor(): Returns the largest integer less than or equal to a number.
* max(): Returns the largest of zero or more numbers.
* min(): Returns the smallest of zero or more numbers.
*random(): Returns a pseudo-random number between 0 and 1.
* round(): Returns the value of a number rounded to the nearest integer.
* sqrt(): Returns the square root of a number.
10. JavaScript Objects :
JavaScript is an Object-Oriented Programming (OOP) language.
A programming language can be called object-oriented if it provides
four basic capabilities to developers −
* Encapsulation
* Inheritance
* Polymorphism
* Aggregation