JavaScript Programming-10 Things-You must be know

Md Miyad Hossain
4 min readMay 5, 2021
JavaScript- one Language for all platforms

What is JavaScript?

JavaScript is a lightweight, interpreted, or just in time compiled programming language. It’s is a multi-paradigm, dynamic, and single-threaded programming language. Before released ES6, many people said, it’s a toy language, but after releasing ES6 it’s changed and added amazing new features. I’m going to share more details.

Variables

There are 3 variables name in javascript: Let, Const and Var. Let’s discuss 3 variables.
1. Let
It’s a new variable of JavaScript which added from ES6. Let variable can declared block level variables and it’s available from itself enclosed in. It’s not accessible from out of itself enclosed block.
The following is an example of Let variable:

2. Const
It’s a new variable of JavaScript which added from ES6. Const variable allows to declared which values can be never changed or updated. it’s available from the declared block in.
The following is an example of Const variable:

3. Var
var variable is commonly used in ES5. it’s freedom of declaration and no restriction. It’s accessible from any block and anywhere.
The following is an example of a variable:

Objects

A JavaScript object is an entity having state and behavior as properties and values. It’s like any other variable but the only key difference is that an object holds multiple values according to properties and values.
There are 3 ways to create objects.

  1. By object literal
  2. By creating an instance of Object directly (using new keyword)
  3. By using an object constructor (using new keyword)

The following is an example of Objects:

Arrays

JavaScript array is an object that can store multiple elements. It’s not required to store the value of the same data type in an array. In JavaScript, an array is an ordered list of values. Each value is called an element specified by an index.
The following is an example of Arrays:

Functions

A function is a group of reusable code which can be called anywhere in the program. JavaScript provides functions similar to most of the scripting and programming languages. In JavaScript, a function allows to define a block of code, then give it a name and then execute it as many times as needed.
The following is an example of Functions:

Recursive Function

A recursive function is a function that calls itself until it doesn’t. And this technique is called recursion. JavaScript allows you to call functions recursively.
The following is an example of Recursive Functions:

Inner Functions

JavaScript function has allowed declaring inner function inside with other function. It provides programmers writing more maintainable code and it’s called a nested function too.
The following is an example of Inner Functions:

Numbers

The Number is a primitive data type in JavaScript. Number type represents an integer, float, hexadecimal, octal or exponential value. The first character in a Number type must be an integer value and it must not be enclosed in quotation marks.
The following is an example of Numbers:

Strings

The JavaScript string is an object that represents a sequence of characters. The internal format for strings is always UTF-16 it is not tied to the page encoding.
The following is an example of Strings:

Operators

JavaScript includes operators as in other languages. JavaScript operators are symbols that are used to perform operations on operands.
The following is an example of Operators:

Boolean

Boolean is a data type that returns two values i.e true and false. It’s used at conditional statements (if-else, switch, while, do…while).

--

--