Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
11 views

String Functions

Uploaded by

ahmed rekik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

String Functions

Uploaded by

ahmed rekik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

String Functions:

1 .length: Returns the length of a string.


2 .toUpperCase(): Converts a string to uppercase.
3 .toLowerCase(): Converts a string to lowercase.
4 .trim(): Removes whitespace from the beginning and end of a string.
5 .concat(): Combines two or more strings and returns a new string.
6 .indexOf(): Returns the index of the first occurrence of a specified value in a string.
7 .lastIndexOf(): Returns the index of the last occurrence of a specified value in a
string.
8 .slice(): Extracts a portion of a string and returns a new string.
9 .substring(): Returns the characters between two specified indices in a string.
10 .charAt(): Returns the character at a specified index in a string.
11 .replace(): Replaces a specified value or regular expression with another value in
a string.
12 .split(): Splits a string into an array of substrings based on a specified separator.
13 .startsWith(): Checks if a string starts with a specified value.
14 .endsWith(): Checks if a string ends with a specified value.
15 .search(): Searches a string for a specified value or regular expression and
returns the index of the match.
Array Functions:
1 .length: Returns the number of elements in an array.
2 .concat(): Joins two or more arrays and returns a new array.
3 .join(): Joins all elements of an array into a string.
4 .indexOf(): Returns the index of the first occurrence of a specified value in an
array.
5 .lastIndexOf(): Returns the index of the last occurrence of a specified value in an
array.
6 .push(): Adds one or more elements to the end of an array and returns the new
length.
7 .pop(): Removes the last element from an array and returns that element.
8 .shift(): Removes the first element from an array and returns that element.
9 .unshift(): Adds one or more elements to the beginning of an array and returns the
new length.
10 .slice(): Extracts a portion of an array and returns a new array.
11 .splice(): Adds or removes elements from an array.
12 .reverse(): Reverses the order of the elements in an array.
13 .sort(): Sorts the elements of an array.
14 .forEach(): Executes a provided function once for each array element.
15 .map(): Creates a new array with the results of calling a provided function on
every element in the array.
Math Functions:
1 .Math.random(): Returns a random number between 0 (inclusive) and 1
(exclusive).
2 .Math.abs(): Returns the absolute value of a number.
3 .Math.round(): Rounds a number to the nearest integer.
4 .Math.floor(): Rounds a number down to the nearest integer.
5 .Math.ceil(): Rounds a number up to the nearest integer.
6 .Math.max(): Returns the largest of zero or more numbers.
7 .Math.min(): Returns the smallest of zero or more numbers.
8 .Math.pow(): Returns the value of a base raised to the power of an exponent.
9 .Math.sqrt(): Returns the square root of a number.
10 .Math.sin(): Returns the sine of a number.

You might also like