Some JavaScript Concepts for Beginner

Md Saddam Hossain Knight
3 min readMay 5, 2021

01. String :

A string is a sequence of characters. It holding data that represented in text form.

Ex.
var name = “Saddam Hossain” ; var age =”28”

· charAt() : it returns a new string consisting of the UTF-16 code units.

EX.
var name = “Saddam Hossain knight”;
var position = 4;console.log(name.charAt(position)); // output : d

·concat(): It concatenates two strings.

Ex.
var a = “I love”;
var b =”Bangladesh”;console.log(a.concat(‘ ‘ ,b)); //output :I love Bangladesh

· includes():It performs case-sensitive search. It return TRUE or FALSE.

EX.
var description =”I am a full stack web developer and I love javascript”;
var word = “javascript”;console.log(description.includes(word)); // output: TRUE

02. Number :

The number is used to represent and manipulate numbers like 7 or 7.5 or -7.004. It may also be expressed in literal forms like 0b101, 0o15, 0x0C.

.isNaN(): This method determines whether the passed value is NaN and its type is Number.

Number.isNaN(NaN);        // true
Number.isNaN(Number.NaN); // true
Number.isNaN(0 / 0); // true

// e.g. these would have been true with global isNaN()
Number.isNaN('NaN'); // false
Number.isNaN(undefined); // false
Number.isNaN({}); // false
Number.isNaN('blabla'); // false

.parseFloat(): It parses an argument and returns a floating-point number.

Ex.
var n =’2.50';
console.log(number.parseFloat(n)) //output: 2.50

.parseInt(): It parses an argument and returns a integer number.

Ex.
var n =’50';
console.log(number.parseInt(n)) //output: 50

03. Math :

It has properties and methods for mathematical constants and functions.

.abs(): It return absolute value of a number.

Ex.
var x = -5;
console.log(math.abs(x)); //output: 5

.ceil(): It round a number up to the largest intger.

Ex.
var x = 5.8;
console.log(math.ceil(x)); //output: 6

.floor(): It round a number up to the smallest intger.

Ex.
var x = 5.8;
console.log(math.floor(x)); //output: 5

.min(): It return a smallest value.

Ex.console.log(math.min(2,4,6,8)); //output: 2

.max(): It return a largest value.

Ex.console.log(math.max(2,4,6,8)); //output: 8

04. Array :

An array is a global object that is used in the construction of arrays; which are high-level, list-like objects. ex: let name =[‘rohim’,’karim’,’ Jamal’];

concat(): It merged two or more arrays.

Ex.
var a = [5, 6, 7];
var b = [8, 9, 10];console.log(a.concat(b)) // output :[ 5, 6, 7, 8, 9, 10]

.push(): It added one or more elements at the end of the array and create a new array.

Ex.
const name = [‘Knight’, ‘Nazifa’, ‘Nafiz’];
const addName = name.push(‘Doli’);console.log(addName); //output: [‘Knight’, ‘Nazifa’, ‘Nafiz’, ‘Doli’];

.pop(): It remove one element at the end of the array and create a new array.

ex. 
const name = [‘Knight’, ‘Nazifa’, ‘Nafiz’, ‘Doli’];
const removeName = name.push(‘Doli’);console.log(removeName); //output: [‘Knight’, ‘Nazifa’, ‘Nafiz’];

05. Function:

Function objects created with the Function constructor are parsed when the function is created. This is less efficient than declaring a function with a function expression or function statement and calling it within your code because such functions are parsed with the rest of the code.

var x= 50;
var y= 40;
function numbers(x,y) {
var z = x + y;
return z;
}
console.log(numbers); //output: 90

06. for loop:

It creates a loop that has three optional expressions, enclosed in parentheses and separated by semicolons.

Ex.
for (let i = 0; i < 9; i++) {
let num = i;
}
console.log(num); //output: 012345678

07. while loop:

It creates a loop that executes a specified statement as long as the test condition evaluates to true. The condition is evaluated before executing the statement.

Ex.
let i = 0;
while( i < 9) {
i++;
}
console.log(i); //output: 012345678

08. if…else:

It executes a specified condition is true. if the condition is false then another statement is executed.

Ex.var a =10;if (a > 0) {
result = ‘positive’;
} else {
result = ‘NOT positive’;
}
console.log(result); //output: positive;

09. switch:

It executes an expression, matching this expression value to a case, and executes it associated with that case.

Ex.
const name= ‘Saddam’;
switch (name) {
case ‘Nazifa’:
console.log(‘Nazifa is one year old’);
break;
case ‘Nafiz’:
console.log(‘Nafiz is 14 years old’);
break;
case ‘Doli’:
console.log(‘Doli is 21 years old’);
break;
default:
console.log(‘Sorry, Not found’);
}

10. SSL Certificate:

SSL certificates are small data files that cryptographically establish an encrypted link between a web server and a browser. This link ensures that all data passed between the web server and browser remain private.

There are three types of SSL certificates.

01. Extended Validation (SV) SSL certificate

02. Organization Validated (OV) SSL certificate

03. Domain Validation (DV) certificate

--

--