How to delete the first character of a string in JavaScript

To delete the first character of a string and assign it to a variable:

javascript
// Example string
let string = 'Erik';

// Getting the first character and updtated string
[character, string] = [string[0], string.substr(1)];

console.log(character);
// 'E'

console.log(string);
// 'rik'

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.