10 basic Javascript core topics.

Mohiuddin Mazumder
2 min readNov 2, 2020

JavaScript is a very powerful client-side scripting language. JavaScript is used mainly for enhancing the interaction of a user with the web page. Today I am going to talk about 10 javascript basic topics you should know about it.

  1. charAt()

var string = ‘Hello’;

var result = string.charAt(0);

console.log(result); //H

The charAt() method returns the character at the specified index in a string.

The index of the first character is 0, the second character is 1, and so on.

2. The concat() method is used to join two or more strings.

var firstName = “Jhon”;

var lastName = “Doe”

var res = firstName.concat(lastName);

// Jhon Doe

3. indexOf()

The indexOf() method returns the position of the first occurrence of a specified value in a string.

This method returns -1 if the value to search for never occurs.

4. length

The length property returns the length of a string (number of characters).

5. slice()

The slice() method extracts parts of a string and returns the extracted parts in a new string.

Use the start and end parameters to specify the part of the string you want to extract.

var string= “Hello world!”;
var res = str.slice(0, 5);

//Hello

6. split()

The split() method is used to split a string into an array of substrings, and returns the new array.

If an empty string (“”) is used as the separator, the string is split between each character.

The split() method does not change the original string.

7. toUpperCase()

The toUpperCase() method converts a string to uppercase letters.

8. toLowerCase()

The toLowerCase() method converts a string to lowercase letters.

9. Number.parseFloat()

Number.parseFloat() method works to convert string to number.

10. endsWith()

The endsWith() method determines whether a string ends with the characters of a specified string.

This method returns true if the string ends with the characters, and false if not.

--

--