Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4265386
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:37:01+00:00 2026-05-21T06:37:01+00:00

I am learning JavaScript and slowly wading my way to understanding why a certain

  • 0

I am learning JavaScript and slowly wading my way to understanding why a certain page does not work 🙂

I am doing something like this:

<a onClick="removeAllMarkers(this)" href="#" >Remove All Markers</a>

With the idea that sending this is the correct way to go about things. But I think I don’t really understand the role of “this” in my current situation.

I am getting a JavaScript console error when I press on the link for “clear all markers” on this page:
http://www.comehike.com/outdoors/trees/add_spotted_trees.php?hike_id=108

The page has login credentials: test@comehike.com | password

Any ideas what I am fundamentally doing wrong and how is the best way to clear the markers[] array?

I am currently doing something like this:

if (markers)
{
    for (i in markers)
    {
         markers[i].setMap(null);
         markers[i] = null;
    }
}

But that is precisely the part which is having the errors unfortunately. Suggestions? 🙂

Here is the page

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T06:37:02+00:00Added an answer on May 21, 2026 at 6:37 am

    Setting an array element to null won’t remove it from the array.


    To clear an array, either assign the variable to a new empty array:

    markers = [];
    

    Or set its length property to 0:

    markers.length = 0;
    

    Do this after looping through the array and calling .setMap(null) on each.


    To only remove only the last item in an array:

    markers.pop();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im just learning javascript and I'm just wondering why this doesn't work. I've created
I am learning javascript sample from this page, http://nofunc.org/AJAX_Star_Rating my questions are (1), for
I am learning javascript sample from this page and I am using IE 7
Im learning javascript, and I am struggling to get my case statement to work.
I am currently learning Javascript, and I'd like to create my own Lorem Ipsum
I am learning JavaScript and in the process, I found that certain operations are
I'm learning javascript. Poked around this excellent site to gather intel. Keep coming across
I'm starting learning javascript for a project, I've found a script that does a
I am learning JavaScript and was asked this question, can anyone help? What do
I'm learning JavaScript, and I've found its prototypal inheritance WAY too verbose. So I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.