Je veux savoir si une chaîne commence par le caractère / chaîne spécifié ou se termine par elle dans jQuery.
Par exemple:
var str = 'Hello World';
if( str starts with 'Hello' ) {
alert('true');
} else {
alert('false');
}
if( str ends with 'World' ) {
alert('true');
} else {
alert('false');
}
S'il n'y a pas de fonction, alors une alternative?