# How to remove the first character from a string in JavaScript

By Atta Ur Rehman Shah (https://attacomsian.com/about). Published Oct 23, 2022, updated Oct 25, 2022. Topics: JavaScript.
Canonical URL: https://attacomsian.com/blog/javascript-remove-first-character-from-string

> Learn how to use the substring() method to remove one or more characters from a string in JavaScript.

You can use the `substring()` and `slice()` methods to remove one or more characters at the start of a string in JavaScript.

## Remove the first character from a string

You can use the `substring()` method to remove the first character from a string. The `str.substring(1)` returns a new string without the first character of the original string.

```javascript
const str = 'JavaScript'

const result = str.substring(1)
console.log(result) // avaScript
```

The `substring()` method extracts characters between the start and end indexes from a string and returns the substring.

> Indexes in JavaScript are zero-based. The first character in a string has an index of `0`, and the last has an index of `str.length - 1`. 

We passed `1` as a starting index to the `substring()` method to exclude the first character `J` from the returned string. The index of `1` specifies that we want to skip the characters at indexes `0` and `1` and get a new string containing the rest.

Alternatively, you could use the `slice()` method to remove the first character from a string, as shown below:

```javascript
const str = 'JavaScript'

const result = str.slice(1)
console.log(result) // avaScript
```

The `slice()` method extracts a part of a string between the start and end indexes, specified as first and second parameters. It returns the extracted part as a new string and does not change the original string.

## Remove the first N characters from a string

You can also use the `substring()` method to remove the first N characters from a string in JavaScript:

```javascript
const str = 'JavaScript'

const removed2 = str.slice(3)
console.log(removed2) // aScript

const removed6 = str.slice(6)
console.log(removed6) // ript

const removed9 = str.slice(9)
console.log(removed9) // t
```

As you can see above, we omitted the end index and only passed a starting index to `substring()` to remove the first N characters from a string.

The `slice()` method can also be used to remove the first N characters from a string:

```javascript
const str = 'JavaScript'

const removed4 = str.slice(4)
console.log(removed4) // Script
```
