Javascript
Published: 2021-12-21 13:17:17

1Javascript String (charAt, concat, includes, endsWith, indexOf, lastIndexOf, replace, slice, split, startsWith, substr, toLowercase, toUppercase, trim, trimStart, trimEnd ).

   Like other programming languages we have String method for a character in javascript.If we have string “wahid ahmed” It cannot have any methods or property bacasuee they are not objects. But with js we can apply string method to it.The charAt() returns the specific position of a string we just need to pass the string to get it’s index.If we want to join to or more strings we can use concat method.Sometimes we need to see if the string contain something we can use include to see it.endsWith returns a boolean value if we use endsWith if it contains the string in last it will return true neither false.The indexOf() method returns the position of the first occurrence of a specified value in a string.It will return -1 if the value dosen’t matches.lastIndexof is case sensitive  if it found the value in last index it will return else it will return -1. Replace will replace the string we want. We want to pass the string we want to replace and next we want to pass the string we want.slice() extracts a part of a string and returns the extracted part in a new string.It takes two parameter.We can convert a string to array with split method.startsWtih is used to find if the word is use in the starting point. toLowercase and toUppercase will lower case and upper case the string we want.substr() is similar to slice().The difference is that the second parameter specifies the length of the extracted part.If we want to remove the spaces from both side of a stirng we use trim .trimStart will remove space from front side of a string and trimEnd will remove space from end.












2. javaScript Number (isNaN, parseFloat, parseInt , Math , Abs, ceil, floor, min, max, random, round, sqrt)
Ans: In javascript we have differnt type of methodes for numbers.isNaN is used to identify is the value is number. If the value is not a number it will return isNaN means not a number.ParseFloat and parseInt  is used to parse the value to float or int type . If we have a float value like 12.225 if we parse it to parseInt it will convert it int value 12.Math() is used to do some mathametical calculation. The ceil returns the upper value and floor returns the lower value.Min and max returns the minimum and maximum value . Randmon ganerates a random value. We use sqrt to root a value.
3.Javascript array( concat, every, filter, find, findIndex, forEach, indexOf, join, map, lastaIndexOf, pop, push, reduce, reverse, shift, slice, sort, splice, unshift).
Ans: Javascript provied some array methods which help use to write our code more efficenlty and make our work easier.The concat method is use to join two array.If we want to execute a function for each element of a array we use every method.The filter() method creates a new array filled with elements that pass a test provided by a function.The find method returns the first value if it passes the condition test.findIndex passes 1 if it passes test and -1 if returns false.The forEach() method calls a function for each element in an array.we can exucute it on empty elements.The pop() method removes  the last element of an array and changes the orginal array.The push method add a element in a array.The reduce() method returns a single value: the function's accumulated result.It does not execute for empty elements.The reverse() method reverses the order of the elements in an array.If we want to add or remove from the beginning of a array we use shift and unshift.The sort() sorts the elements of an array.The splice() method adds and/or removes array elements.
 
 
4. try-catch.
Ans:try catch is used handle errros in our code. Some times some code can crash our application. It could be user fault or others. That’s why we use try-catch .Inside it try is used to the work we want to do it with it. And catch is used to handle errors. We can use only try . We have to use both of them.
 
 
 
 
5. ES6( Var let const, Functions with Default Parameter Values, template string, The Spread Operator, destructuring, Arrow Function)
Ans:Es6 provied us some new feature. For variable declration we use var,let,const in our cdoe. Var is global it can be re-declare and it’s value can be changed to .And let, const is block scope variable we can’t redeclare the variable it can be accesed only inside block scopes. We can change let value but can’t change the const value it will throw an error.Some times we use default parameters we provide value inside a function . Template string help us to write dynamic string and pass variable value inside a string.Spread operator get all the value inside it. Destructuring is used to destructure value of object and keep it to other variable and we can use it. Arrow function help use to write short functions and return value without writning functions or it’s name.
.