JavaScript fundamentals
Hello everyone! I am sharing my little knowledge about JavaScript fundamental of Number, String, and Array properties.
1.Number()
Number() is a function that allows us to convert a value to a number.
Example:
2. ParseInt()
ParseInt() is a function that is used for converting a float value to an integer. It also can take a number value in string format and convert it to an integer.
Example:
3. charAt()
charAt() is a method to get a specific character (alphabet) of a sentence by giving its position (number -1);
4.concat()
concat() is a method to create a new string by adding two string value.
Example:
5.indexOf()
indexOf() is a method to search the existence of a value in a string. If existed then return the position number of that letter of the first letter of the word. Else it returns a negative value. a negative value means that value doesn’t exist in the selected string value.
Example:
6. toUppercase, toLowercase :
toUppercase() is a method to transform a string’s letter to the upper case. In the same way, toLowercase() transform to lower case all letters of a string.
7. push, pop, shift, unshift:
i. push is a method of inserting an element in the last element position of an array.
ii. pop is a method of removing an element from the last element position of an array
iii. the shift is a method of removing an element from the first element position of an array.
iv. unshift is a method of inserting an element in the first element position of an array.
Example:
8.slice()
slice is a method of getting a part of an array.
Example:
9.find()
find() is a method to find the first matched value from an array by giving any condition.
Example:
10.filter()
filter() is a method of getting all matched elements from an array by giving condition;
Example: