Re-Take & Overview JavaScript

Nasir Uddin
3 min readMay 5, 2021

Concat()

  • Concat is the built-in method of javascript languages
  • When two string are added then javascript used concatenate function
  • Concatenate string output value return is a new string value.
  • Example Below:

const firstName = “Nasir”;

const lastName = “Uddin”;

const hello = “Hello”;

const how = “How are you”;

console.log(hello.concat(“ “ + firstName + “ “ + lastName + “ “).concat(how));

IndexOf()

  • When we are fined any word from our string we use indexOf()
  • IndexOf() is a built-in function
  • Getting the string position your search that.
  • This function is used for getting items from the array, string, and number
  • When the search word can’t find from string indexOf() are return (-1)
  • How to use indexOf() function.
  • Example Below

const love = “I love Bangladesh”;

console.log(love.indexOf(“Bangladesh”));

const bangladesh = “Bangladesh”;

const getLove = love.indexOf(bangladesh);

console.log(getLove);

Slice

  • Slice gives a new string from the base string.
  • we need to slice when we are taking a small part of the array, objects, and string from a single word
  • Slice is a built-in function and it’s using the start & end method for slicing
  • Below the example:

const word = “I want to be a good developer. I will hard work “;

const word1 = word.slice(13, 29);

const word2 = word.slice(13, -1);

console.log(word1);

console.log(word2);

ParseInt

  • When we any number are takin with string then we are converted this string and getting integer value.
  • Example Below:

const number = “353”;

console.log(number);

console.log(parseInt(number));

console.log(parseInt(0xf, 16));

Math.ceil()

  • Math ceil is static method for set the number value
  • Math ceil is not a constructor function
  • Example Below:

console.log(Math.ceil(0.85));

console.log(Math.ceil(0.6));

console.log(Math.ceil(0.3));

console.log(Math.ceil(0.45));

Math.Round()

  • Math round is dynamic method for round the integer numbers
  • Math round following when integer number nearest to .50 convert that integer 0
  • Math round are created integer when the integer up to .50 then it self created integer 1.
  • Example below:

console.log(Math.round(0.48));

console.log(Math.round(0.5));

console.log(Math.round(0.55));

console.log(Math.round(0.9));

Array.Map()

  • The map always returns one for each element from an array. The map provides a callback function. It’s created a new constructor array.
  • Example Below:

const arr = [

{

id: 1,

name: “name”,

address: “address”,

phone: 1233,

job: “developer”,

country: “country”,

},

{

id: 1,

name: “name”,

address: “address”,

phone: 1233,

job: “developer”,

country: “country”,

},

{

id: 1,

name: “name”,

address: “address”,

phone: 1233,

job: “developer”,

country: “country”,

},

{

id: 1,

name: “name”,

address: “address”,

phone: 1233,

job: “developer”,

country: “country”,

},

{

id: 1,

name: “name”,

address: “address”,

phone: 1233,

job: “developer”,

country: “country”,

},

{

id: 1,

name: “name”,

address: “address”,

phone: 1233,

job: “developer”,

country: “country”,

},

{

id: 1,

name: “name”,

address: “address”,

phone: 1233,

job: “developer”,

country: “country”,

},

{

id: 1,

name: “name”,

address: “address”,

phone: 1233,

job: “developer”,

country: “country”,

},

{

id: 1,

name: “name”,

address: “address”,

phone: 1233,

job: “developer”,

country: “country”,

},

];

const newArr = arr.map((user) => user.name);

console.log(newArr);

Array.find()

  • Find method immediately returns the value of element from an array. then matching the targeted value from the array & return result.
  • Example Below:

const number = [5, 12, 80, 130, 44];

const findNumber = number.find((num) => num > 80);

console.log(findNumber);

Array.pop()

  • Pop are used for remove the last word from array.
  • Example Below:

const friends = [“Rohim”, “korim”, “Jabbar”, “Akkas”, “Babol”];

console.log(friends);

const removeFriend = friends.pop();

console.log(removeFriend);

console.log(friends);

Array.shift()

  • Shift methods are used for remove the first element form array.
  • Example Below:

const user = [“Adol”, “Badol”, “Kadol”, “Jodol”];

console.log(user);

const shiftUser = user.shift();

console.log(shiftUser);

console.log(user);

--

--