1

element.innerHTML = ''

*when getting objects in an array, remember that its an array methofrememebr that its an ARRAY method

   ex : array.forEach(element/or obj) depending if the obj is nested in the array
   dont forget .innerText = element
   if array in obj do res.nameofarray.forEach
prevetdefault is a method()

.value 

This is a question regarding javascript

likeButton.addEventListener('click', (e) => {
    let currentLikes = parseInt(likes.innerText)
    currentLikes++
    likes.innerText = currentLikes
})```
2
  • 2
    Can you reword this? I have no idea what your asking, what is "methofrememebr"? And what is your is your first example? Commented Jul 14, 2022 at 17:54
  • 1
    I would try updating the question, its not clear. Commented Jul 14, 2022 at 17:54

1 Answer 1

0

I'm not 100% sure what your asking, but creating an array with arrayName = [' ', ' '] makes array have the values of spaces, not null's. If you want an array filled with null you have to create it with arrayName = [null, null] (you can also make an empty array and fill it with null's as shown here: Javascript - Initialize array with nulls)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.