JavaScript in simple language.

01 JavaScript?

Tareq Hassan
4 min readMay 6, 2021

--

Javascript is a scripting language also a dynamic programming language. In 1995 Brendan Eich make it come to the market to make a good user experience on the web. After 25 years JavaScript becomes a top-rated programming language, especially after Node Js. Node Js late Javascript operate on Sarver. Now JavaScript use for Creating web apps, Mobile apps, Game Development and also Adding interactive behavior in Websites.

02. Basic JavaScript Output

Every language has its own rule to show output, JavaScript also displays its output according to a set of rules. Suppose now I will show you how to show the “Hello World” as the output.

document.write(“Hello World”);

03. What is JavaScript Variable?

Variable is one kind of container. we use variables to store data to use it when needed. Variable works the same way in all programming languages

04.What is JavaScript Data Type?

There are different types of data types in JavaScript to hold different values, that is, to work with different types of data. Like String for hold text, Number for hold Number Bullien for true and false, etc.

The data type is a major consideration in any programming language. When working with a variable, it is important to know what type of data it is, for example, see the code below.

Let name = “Tareq Hassan”+2014;

The data type is not specified here, “Tareq Hassan” will display this text by adding 2014. that is, it will display the text “Tareq Hassan2014”. Cause to add a text string to a number, JavaScript also takes the number as a string.

There are 5 types of primitive data types in JavaScript.

_String.
_Number — Sets mathematical or numeric values.
_Undefined — Sets the Undefined value.
_Boolean — sets values ​​using only two values, “true” and “false”.
_Null — sets the value to zero or null.

05. JavaScript Function.

JavaScript codes do a function contain, which are usually activated or worked by an event or a function call. The function of JavaScript is a type of object. Functions can be returned from functions in JavaScript. A JavaScript function can be stored in a variable, another function can be used as an argument for one function

Example of Basic Function:

function myFunction(parameterOne, parameterTwo, parameterThree) {
// Here your code!
}

06. What is JavaScript Object?

JavaScript is an object-based web programming language. Almost Everything in JavaScript is an object. The English word “Object” literally means “object”, JavaScript Object means a special type of data that has properties and methods. All JavaScript objects have their own properties and methods. In JavaScript, we can create objects and variable types as required. Programming is done using the properties and methods of the JavaScript object.
There are two types of objects in JavaScript.
-
Built-in object
- User-defined object.

07. JavaScript Array method.

An array can be used to hold more than one value in a variable and we can have any type of value. An array is a special type of JavaScript variable that can capture the same type of information or data used in a single task through a single JavaScript variable. In this case, these array objects can be accessed through their subscript. The position of the first element of the array is 0, the position of the element is 1, the position of the third element is 2.
For example
, if we can declare the name of some product as a single variable. But if the number of our products is 200, it will be very difficult to determine in this way. The correct solution is to use arrays. Or we can use arrays to find specific products from 200 products.

08. JavaScript String.

JavaScript string is an object used to modify or manipulate a text. JavaScript’s string object 2 is used to modify or manipulate other text.

There are two ways to create JavaScript strings.
1. Using string literal
2. And Using string objects.

See the syntax for creating a JavaScript string using a string literal and using a string object.
var stringOne=” write string value”;
var stringTwo=new String(“string literal”);

09. JavaScript Number.

By default, JavaScript expresses mathematical numbers in decimal numbers. But using JavaScript’s toString () we can use 2 to 36 based number systems, for example — binary number system 2 based, octal number system 8 based, decimal number system 10 based, hexadecimal number system 16 based and so on. Only one type of the number can be used in JavaScript. However, this number can be written using decimals and can also be written without decimals.
Example:
var Auntor = 5;
// is written without decimal.
var Auntor= 5.12 // written with decimal.

10. What is JavaScript Loop?

When writing a JavaScript program, in some cases you have to use the same code over and over again to do the same thing. The same type of code can be rewritten using JavaScript loops without having to rewrite the base multiple times. For example, we want to find only the even numbers from the numbers from 1 to 100, in this case, a condition can be given without typing the same code again so that the even numbers from 1 to 100 can be found. In other words, if you want to do the same thing in a program for a certain period of time, it is better to use JavaScript’s loop statement.

For Create a program using a loop reduces the complexity of JavaScript, as well as the size of a webpage or JavaScript file. There are 4 types of loops in JavaScript.
01. for loop.
02. while loop.
03. do while loop.
04. and finally for in loop.

--

--