So let’s turn around a bit.
Let’s recall the kinds of quotes.
Strings can be enclosed within either single quotes, double quotes, or backticks:
2. String toLowerCase() & toUpperCase() Method
The index number starts from 0 and goes to n-1, where n is the length of the string. The index value can’t be a negative, greater than or equal to the length of the string.
Java string Concat() method concatenates multiple strings. This method appends the specified string at the end of the given string and returns the combined string. We can use the Concat() method to join more than one strings.
4. Searching For a substring(), indexOf() & lastIndexOf()
Method substring() returns a new string that is a substring of a given string. Java String substring() method is used to get the substring of a given string based on the passed indexes. There are two variants of this method. In this guide, we will see how to use this method with the help of examples.
The index position of the first character in a string always starts with zero. If an element is not present in a string, it returns -1.
There is also a similar method str.lastIndexOf() that searches from the end of a string to its beginning.
It would list the occurrences in the reverse order.
You can change the position where the search will start in the string by providing a start_position parameter to the lastIndexOf() method.
Use the following syntax to create an Array object −
var fruits = new Array( "apple", "orange", "mango" );
The Array parameter is a list of strings or integers. When you specify a single numeric parameter with the Array constructor, you specify the initial length of the array. The maximum length allowed for an array is 4,294,967,295.
You can create an array by simply assigning values as follows −
var fruits = [ "apple", "orange", "mango" ];
6. Array filter, find & findIndex
7. Array pop, push & reduce
The reduce() method reduces the given array into a single value by executing a reducer function. The user implements the reducer function that works on every element present in the array.
8. Array slice, sort & splice
The Number object represents the numerical date, either integers or floating-point numbers. In general, you do not need to worry about Number objects because the browser automatically converts number literals to instances of the number class.
isNaN(value) converts its argument to a number and then tests it for being
But do we need this function? Can’t we just use the comparison
=== NaN? Sorry, but the answer is no. The value
NaN is unique in that it does not equal anything, including itself:
alert( NaN === NaN ); // false
The math object provides you with properties and methods for mathematical constants and functions. Unlike other global objects, Math is not a constructor. All the properties and methods of Math are static and can be called by using Math as an object without creating it.
Math.abs() the method is used to calculate the absolute (positive) value of a number. Therefore, -1 is returned as 1, -5 as 5, and so on. Here is an example:
We have now learned the Core Concept of what can accomplish. If you feel inspired to build on these examples. Cheers!