Checking the characters of a string in JavaScript

Let some string consisting of digits be given:

javascriptlet str = '12345';

Let's check if the first character of this string is equal to the number 1:

javascriptlet str = '12345';

if (str[0] == 1) {
  console.log('!');
}

Let's now check the last character for equality to the number 5:

javascriptlet str = '12345';
let last = str[str.length - 1];

if (last == 5) {
  console.log('!');
}
Задание 1

Given a variable containing some string. Check that this string starts with character 'a'.

Задание 2

Given a variable containing some string. Check that this string ends with the character 'x'.

Задание 3

Given a variable containing some string. Check that this string starts with the character 'a' or the character 'b'.