DEV Community

loading...

Some Method

fateminsupria profile image Fatemin Supria ・2 min read

1.Arrow function:
Arrow function give us an alternative way to write a shortest syntax function for expression.
Example:suppose,add two number
let add =function(a,b)
return a+b;
}
console(add(5,12));
output:17
Same thing with arrow function
let add = (a,b) => x + y;
console.log(add(5,12));
output:17

2.Try catch:
JavaScript provides six primitive types as undefined, null, boolean, number, string, and symbol , and a reference type object
try {
//code testing process
}
catch(err){
//error handling process
}

3.ES6:
An Updated version of JavaScript
Syntax--const,var,Spread operator etc.

  1. ES6 Destructuring: Destructuring that allows you to destructure an array into individual variables. Example: fuction addNumber(){ return[5,7,8]} returned value to a variable var number =addNumber(); for individual score let a =number[1], b=number[2], c=number[3];

5.Error handling:
If a problematic situation come then two things happen. Programmer code is wrong or Forget to pass a required function.Other side if the program needs a name but it gets back an empty string .In that situation need error handle.

6.Cross browser testing:
Cross browser testing as the name suggests verifying the Functionality of the website on the different common browsers that are widely used right now in the market.
Its important because:
-->To verify that what is wrong with your web application’s layout on the “Essential Browser or OS list“.
--> To provide an excellent User experience without any Browser or Device preferences.

7.Client caches:
Client caches mean its always need for client. Sometimes it is not large.Its help limit data cost for keeping commonly referenced data locally.

8.slice()
The initial string in a certain portion and return a new string
Example: let str ="i love bd"
let res =str.slice(0,2);
console.log(res);
output: 'bd'

9.ChartAt():
It is a method in a string that returns a new string with the value of a certain index that is included as a parameter of the method.
Example:
const x ="bangladesh"
console.log(x.chartAt(5))
output:"l"

10.replace():
Replace is a method that substring of a primary string which is given as a parameter of the method.
Example:
let str ="fatemin bd";
let addstr - str.replace("fatemin","bangladesh");
console.log(addstr);
output: "bangladesh,bd"

Discussion (0)

Forem Open with the Forem app