JS Array & Methods
JS Array & Methods
charAt(position)
charCodeAt(position)
Property access [ ]
The method returns a UTF-16 code (an integer between 0 and 65535).
Property Access [] on strings
Property access:
The lastIndexOf() method searches the string from the end to the
beginning.
The lastIndexOf() method returns the index from the beginning (position
0).
If the separator is omitted, the returned array will contain the whole
string in index [0].
If the separator is "", the returned array will be an array of single
characters:
slice(start, end)
substring(start, end)
substr(start, length)
If you omit the second parameter, the method will slice out the rest of
the string.
The difference is that start and end values less than 0 are treated as 0 in
substring().
If you omit the second parameter, substring() will slice out the rest of
the string.
The difference is that the second parameter specifies the length of the
extracted part.
If you omit the second parameter, substr () will slice out the rest of the
string.
The valueOf() method can be used to convert a string object into a string.
JS ARRAY METHODS
JavaScript Array concat ()
The concat() method concatenates (joins) two or more arrays.
The concat() method returns a new array, containing the joined arrays.
The every() method returns true if the function returns true for all
elements.
The every() method returns false if the function returns false for one
element.
The every() method does not execute the function for empty elements.
Start and end position can be specified. If not, all elements will be filled.
JavaScript Array filter ()
The filter() method creates a new array filled with elements that pass a
test provided by a function.
The filter() method does not execute the function for empty elements.
The find() method does not execute the function for empty elements.
The findIndex() method returns the index (position) of the first element
that passes a test.
The findIndex() method does not execute the function for empty array
elements.
By default the search starts at the first element and ends at the last.
Negative start values counts from the last element (but still searches
from left to right).
JavaScript Array.isArray ()
The isArray() method returns true if an object is an array,
otherwise false.
The some() method executes the callback function once for each array
element.
The some() method returns true (and stops) if the function returns true for
one of the array elements.
The some() method returns false if the function returns false for all of the
array elements.
The some() method does not execute the function for empty array
elements.
For numbers: