Javascript 10 Operation

1. Concat

The concat() method is both used in string and array. In String concat() method concatenates the two or more sperate string and return a new string. In array concat() method is same working like string concat() operation. Here concat() method is used to marge two or more arrays. And it behaviour also same as string concate(). Array concat() method is return a new array without changing existing arrays. The concat() method is resive one or more parameters for that is conneting the initial string or array.

2. IndexOf

The indexOf() method is both used in string and array. In String indexOf() method return the index within specified value in starting the search and end. If index is not found return -1. In array indexOf() method is same working like string indexOf() operation. Here indexOf() method return the index within specified value in array the search and end If index is not found return -1. The indexOf() method is resive two parameter first one is serch element and second one is form index. Form index is default value is 0.

3. Includes

The includes() method return true or false depeldent on array elemets if array elemetn found it’s return true else return false. includes() method resive two parameters first one is serch elemet and seconde one is form index.Form index is default value is 0.

4. Join

The join() method concatenating all of array elements and return a string separated by commas or specified separator pass with join() method parameter.

5. Slice

The slice() method is both used in string and array. In String slice() method extracts a section of string and return a new string without modifying the original string. In array slice() method is same working like string slice() operation. Array slice() method is return a part of array without changing existing arrays. The slice() method is resive two parameters first one is start index that means whet ot start copy and last one is end index where to stop operation.

6. Splice

The splice() method is an array method. The splice() method romove one or more array element and add one or more array element in remove index position. The splice() method can resive two or more parameters . First one is start index second one is delete count and more is adding elements. Start index is integer and it’s define where to start changing the array. Delete count is an integer and it’s define what the number of elements in the array to remove from start. And the third or more parameter is any type that’s added in remove position. The splice() method replace the original element.

7. toFixed

The toFixed() method is formate a number with point notation and reurn a string representing the given number with point notation. The toFixed() method resive a integer parameters that specific how many number of digits to appear after the decimal point.

8. Trim

The trim() method removes whitespace from both ends and start. The trim() method return a new string without whitespace from both its beginning and end. The trim() method is combination of trimStart() and trimEnd().

9. Math

Math is a javascript built-in object. Mant has many properties and methods for mathematical constants and functions for done operation. Math all properties and methods is static. Math works with the number type.

10. Ternary

The ternary is a conditional operater followed by condition and expression. If the condition is true it execute truthy expression else execute falsy expression and return result. Ternary operator is a shortcut of if..else condition. But small difference between to if..else and ternary. Ternary operator always return statement result after exucution but its not mandatory for if…else condition.