Top 10 uses of JavaScript

Introduction: JavaScript is a programming language that allows you to implement complex features on web pages. Javascript has many uses. it can dynamic our site. Html CSS javascript combination makes a website perfect.
IndexOf in Javascript: The index of method uses is very simple first you need to declare a variable then in the second line use indexOf(3) if your previous line has 3 in the 4th number of position the result shows 3.
Example:
var friendsAge = [15, 17, 14, 3]
var result = friendsAge.indexOf(3)
Push Or Pop uses in JavaScript: Firstly I write about push. it has very simple uses. if you have an array and there are 5 different numbers. once you think I need to add a number just simple uses the push method and your added number will show at the end of your previous number. Now Pop method if you have a list of your friend's names think if you have 10 friends in your list of the array you decide you will kick out a friend on your list then just simply use the pop method.
Example:
names= [‘abbas’, ‘khaled’, ‘jakir’]
names.pop(jakir);
numbers= [1,2,3,4,5]
numbers.push(6);
Slice method in JavaScript: The slice method is simply difficult you need to first declare an array list of any names or numbers then you can use the slice method. it's a very interesting function.
Example:
var teaLine = [‘palam’, ‘kalam’, ‘salam’, ‘balam’];
var part = teaLine.slice(1, 3);
Math Random and Round use of javaScript: First talk about random function uses in js. Random means Random. If you declare random () * 100 it shows the different numbers again and again in the number 100. Round means if you have 1.2 it's round to 2.
Example:
var number = Math.random () * 100
var result = Math.round(number)
Map function uses in javascript: First declare a list of numbers then map it and it shows a list of your numbers. It's the best function to get rid of writing HTML again and again.
Example:
const numbers = [3, 4, 5, 6, 7, 8];
for(let i = 0; i < numbers.length; i++){
const element = numbers[i];
const result = element * element;
}
const result = numbers.map(x => x * x);
Uses of filter in JavaScript: Filter means think you declare an array and this array have 1 to 10 numbers Then you apply filter method like x > 3 means 1 to 3 filter in your array.
Example:
const numbers = [3, 4, 5, 6, 7, 8];
for(let i = 0; i < numbers.length; i++){
const element = numbers[i];
const result = element * element;
}
const result = numbers.filter(x => x < 5);
Uses of find in JavaScript: Find are similar to Filter this function use to find your element on your array.
Example:
const numbers = [3, 4, 5, 6, 7, 8];
for(let i = 0; i < numbers.length; i++){
const element = numbers[i];
const result = element * element;
}
const isThere = numbers.find(x => x > 5)
LowerCase and UpperCase use in JavaScript: its a very simple uses in js. if you declare a sentence just add to uppercase and then see all letters are in uppercase. similar thing in lowercase just adds to lowercase then see all letter are in lowercase.
Example:
var name= “Hello Shakib”;
var result= name.toUpperCase();var name= “Hello Shakib”;
var result = str.toLowerCase();
Shift Unshift use in JavaScript: Shift method removes the first item of an array. suppose you have a list of your friends simply use the shift method to remove the first friend of your array. unshift function are the opposite of the Shift function. it's just adding a new item on the first of your array just include what you wanna add.
Example:
var names= [“halim”, “karim”, “jamal”, “estiak”];
names.shift();var names= [“halim”, “karim”, “jamal”, “estiak”];
names.unshift(“akash”,”asif”);
join method in JavaScript: The join method returns the array as a string. it's very simple uses.
Example:
var names= [“akash”, “batash”, “hakim”, “usman”];
var result= names.join(“and”);Output: akash batash hakim and usman