Advance Concept of javaScript

masud howlader
3 min readMay 6, 2021

--

JavaScript is a powerful programing language. Nowadays knowledge about JavaScript is must necessary for being a good programmer or developer.

Today I will discuss some JavaScript Advance Concept.

Understanding of JS Primitive

Primitive values are numbers and strings among others things. There are 6 primitive types and an Object type.

1. Undefined

2. Null

3. Number

4. String

5. Boolean

6. Symbol

Undefined

undefined is a property of the global object. That is, it is a variable in the global scope. The initial value undefined is the primitive value undefined.

function test(t) {

if (t === undefined) {

return ‘Undefined value!’;

}

return t;

}

let x;

console.log(test(x));

// expected output: “Undefined value!”

Null

The value null represents the intentional absence of any object value. It is one of JavaScript's primitive values and is treated as falsy for boolean operations.

typeof null === ‘object’ // true

Number

There is only one number type. There is no specific type for integers. The number can be written with or without a decimal point. It is able to represent floating-point numbers, the number type has three symbolic values: +Infinity, -Infinity, and NaN (not-a-number).

var num1 = 10;
var num2 = 15.5;
var num3 = 20 / +0;
console.log(num3);
var num4 = 20 / -0;
console.log(num4);

String

A string in JavaScript is a sequence of characters. In JavaScript, strings can be created directly by placing the series of characters between double (“) or single (‘) quotes.

var str1 = “Hello, World!”;
var str2 = ‘Hi, Welcome to JavaScript Tutorial’;

Boolean

It is logical a entity. A variable can have two values true or false.

var isActive = true;
var isDisabled = false;

Symbol

New in ECMAScript6. A Symbol is a unique and immutable identifier.

var x = Symbol();
var y = Symbol(10);
var z = Symbol(‘Hello’);
console.log(x);
console.log(y);
console.log(z);

Js Objects

In JavaScript, an object is a standalone entity, with properties and type. Compare it with a car, for example. A car is an object, with properties. It has a color, a design, weight, a material, it is made of, wheels, etc.

var myCar = {
make: ‘Ford’,
model: ‘Mustang’,
year: 1969
};

Js Functions

In JavaScript, a function allows you to define a block of code, give it a name and then execute it as many times as you want. A JavaScript function can be defined using a function keyword. I will discuss functions in detail and their parameters in a different article sometime.

Note: If you are writing several “helper” functions and the code that uses them, there are three ways to organize the functions.

Example

function functionName(param) {
return param+ param;

JS Coding Style

Your code should be human readable, clean, well commented, meaningful naming for variables and functions and here I am giving some tips.

--

--