Final answer:
To perform the given tasks, you can use JavaScript string functions to manipulate the label text. You can remove a specific character, substitute one word with another, add text at the end, or substitute one word with another in the label text.
Step-by-step explanation:
To accomplish the given tasks, you can use string functions in JavaScript. Here's how you can do each of the tasks:
- Removing "I" from the label text:
const labelText = document.querySelector('#labelId').textContent;
const modifiedText = labelText.replace('I', '');
document.querySelector('#labelId').textContent = modifiedText; - Substituting "I" with "You":
const labelText = document.querySelector('#labelId').textContent;
const modifiedText = labelText.replace('I', 'You');
document.querySelector('#labelId').textContent = modifiedText; - Adding "very much" at the end:
const labelText = document.querySelector('#labelId').textContent;
const modifiedText = labelText + ' very much';
document.querySelector('#labelId').textContent = modifiedText; - Substituting "love" with "hate":
const labelText = document.querySelector('#labelId').textContent;
const modifiedText = labelText.replace('love', 'hate');
document.querySelector('#labelId').textContent = modifiedText;