Some knowledge about JavaScript

Ahsan Ullah
3 min readMay 5, 2021

Hello, my programmer's friends!!

Today I will discuss some basic concepts of javascript. I will try to introduce that very easily and with fun.

Let's go mission start!!

5 concepts from Javascript string :

Concat Method: Imagine you and your wife is coding now on a computer. You say your wife “I Love” and your wife says to you “You”. Then you think, you code these two strings in a single line. So you use “concat() ”method. Like this…

var husband = “I Love”; 
var wife = “You”;
//I Love You

Includes Method: You call your friend and share with him your new idea. When you talk with your friend then you type your idea in a variable. After that, you think … are you write your important text in code or no!! So you want to find your important text in code by the “ includes()” method. SO you find Like this …

var ideas = “Hello friend. I will write 10 basic concepts about javascript in medium”; 


You will get back your value is true. So my dear !! you should know that includes method return his result by true and false.

EndsWith Method: You call little sister!! Then you write this in a variable. You think.. are you finish your code with your little sister's name or no!? So you find the last part of your variable by “endsWith()” method. Like this …

var call = “Hello my dear little sister”;
console.log(call.endsWith(“Asma”) );

The code return you, your value is “false”. Because you don't write sister name in last part. So my friends !! you should know that the “endsWith()” method returns its result by true and false.

Replace method: You store in a variable your father's name!! But you mistake in a part of the name. So you want to change this string variable using the “replace()” method. like this…

var fatherName = “My father name is Mr. Abdullah Jahangirh”;
console.log(fatherName.replace(“Jahangirh”, “Al-Amin”));
//result :'My father name is Mr. Abdullah Al-Amin'

Slice method: You like to eat bread. So you slice your bread every day. Today you think that you will slice your string from your variable. So you work by “ slice()” method like this…

var myText = “Hello I am slice now my code”;
//result: ' slice now my code'

5 concepts from Javascript Array:

Filter method: My programmer's friends!! Imagine.. you made a group for learning a programming language. You store your friend's name in an array. Suddenly you see your one friend is very selfish. So you want to remove this friend from your array. For this, you use “filter()”method like this…

var friends = [“Masum”,”Hassan”,”Sabit”,”Robi”,”Khaled”]
var deleteSelfish = friends.filter((friend) => friend != “Robi”)
//new array: [ 'Masum', 'Hassan', 'Sabit', 'Khaled' ]

Find method: In your Facebook friend list is many friends. But you find a specific friend. So you use “find()” method like this…

var friends = [“Ahsan”,”Sakib”,”Shamim”]
var bestFriend = friends.find((friend) => friend == “Sakib”)
//result: "Sakib".

ForEach method: You call many friends in your house. And you gift all some food. You write this in your code dairy at night like this…

var friends = [“Ahsan”,”Sakib”,”Shamim”]
var bestFriend = friends.forEach((friend) => console.log(`Hello my dear friend ${friend} this packet of “Piza” for you!!`))
//'Hello my dear friend Ahsan this packet of "Piza" for you!!'
//'Hello my dear friend Sakib this packet of "Piza" for you!!'
//'Hello my dear friend Shamim this packet of "Piza" for you!!'
//'Hello my dear friend Robi this packet of "Piza" for you!!'

Push Method: When you come from school life to college life. You will get some new friends. So you will write in your code dairy in your array by “push()” method like this …

var friends = [“Ahsan”,”Sakib”,”Shamim”,”Robi”]
var addFriend = friends.push(“Abdullah”);

Pop method: You want to remove from your code dairy your last friend's name. So you use “pop()” method like this…

var friends = [“Ahsan”,”Sakib”,”Shamim”,”Robi”]
var removeFriend = friends.pop();



Ahsan Ullah

I am a web developer. I have excellent skills in web development. Worked in HTML, CSS3, Reactjs,Nextjs, Javascript, TypeScript, Bootstrap, and MaterialUI.