<script>
document.querySelector('.sent').addEventListener('click', function() {
const player = document.querySelector('.player');
const value = document.querySelector('.input');
player.volume = 1.0;
player.src = value.value;
});
</script>
In this one there is no event further down in the code, so this isn’t needed then:
And it should just stay a function. How it’s written in Code 1. (e) =>
Nope. You’re misunderstanding the difference between arrow functions and regular functions. It’s all explained in the link below. I suggest you read the parts of that page that are relevant to your question.
Mate, I’ve given you the answer in the posts above. I’m afraid I don’t have the time nor energy to go on a 200 post question and answer spree with you ignoring my answers and permanently changing the goalposts.
Read the link above then take some time to try and understand the concepts involved.
I don’t know if I would call the use of arrow functions “better”. They are what many call “syntactic sugar”. That is, they are an alternate that some may prefer for whatever reasons.
For an analogy consider the contraction of “should not”. Is “shouldn’t” better? Without understanding what it is one could make the observation that one form has a space and a second " o " and the other has an " ’ ". One might wonder if the second needs the " ’ " and whether or not “shouldnt” would work.
IMHO, if there is a chance that the contraction would be more difficult to read and interpret what it means, moreso if it might be used incorrectly, then there is no harm in using “should not”.
You missed my use of the word “analogy”. My rough definition: “an off-topic example used to illustrate similarities as a way of providing insight into the original”.