我是JS的初学者,想知道带if语句的arrow函数和常规函数(如function)的语法是什么
getStringLength(string){
let stringLength;
if (string.length === 1){
stringLength = `La chaîne contient qu'un seul caractère`;
} else {
stringLength = `La chaîne contient ${string.length} caractères`;
}
return stringLength;
}