I'm ought to do it without loops. with "if" and "else".
The user writes a random word in the text field at the html and the function needs to check if the first and last letters are equals.
If they are equal - the function will return the string without the first and the last characters. if the characters are not equal - the function will return the written string by the user.
unction firstLastletter(){
    let k = document.getElementsByClassName('text').value;
    let other = 'changed the string';
    
if(k.slice(0) == k.slice(-1)){
    return console.log(k);
}
else {
    return console.log(other);
}
}i know that i miss a lot. but i have no clue how to implement the code in a right way.
many thanks..
 
    