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

  • Home
  • SEARCH
  • 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 6161941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:34:00+00:00 2026-05-23T21:34:00+00:00

I placed an alert in my javascript code to use for debugging purposes. Now

  • 0

I placed an alert in my javascript code to use for debugging purposes. Now that the code works I would like to remove the alert. I am able to remove all other alerts without a problem, but when I try to remove this particular alert the rest of the code that follows fails to execute. What is causing this to happen?

see excerpt of code:

var points = [];
alert("declare array");
var bounds = new google.maps.LatLngBounds();
// Calculate the points
// Work around 360 points on circle
for (var i = 0; i < 360; i++) {
    var theta = Math.PI * (i / 16);
    // Calculate next X point 
    circleY = longitude + (cLng * Math.cos(theta));
    // Calculate next Y point 
    circleX = latitude + (cLat * Math.sin(theta));
    // Add point to array 
    var aPoint = new google.maps.LatLng(circleX, circleY);
    points.push(aPoint);
    bounds.extend(aPoint);
}
points.push(points[0]); //to complete circle
var ne = bounds.getNorthEast(); //northeast boundary of rectangular bounds
var sw = bounds.getSouthWest(); //southwest boundary of rectangular bounds
for (var i = 0; i < statesobj.length; i++) {
    for (var j = 0; j < statesobj[i].values.length; j++) {
        if (bounds.contains(statesobj[i].values[j])) {
            var latChange = ((ne.lat() - sw.lat()) / 100);
            var pt2 = new google.maps.LatLng(sw.lat() - latChange, statesobj[i].values[j].lng());
            var intersections = 0;
            for (var l = 1; l < points.length; l++) {
                var seg1 = points[l - 1];
                var seg2 = points[l];
                var latdiff1 = seg2.lat() - seg1.lat();
                var latdiff2 = pt2.lat() - statesobj[i].values[j].lat();
                var londiff1 = seg2.lng() - seg1.lng();
                var londiff2 = pt2.lng() - statesobj[i].values[j].lng();
                if (londiff2 * latdiff1 - latdiff2 * londiff1 != 0) {
                    var segtest1 = (londiff1 * (statesobj[i].values[j].lat() - seg1.lat()) + latdiff1 * (seg1.lng() - statesobj[i].values[j].lng())) / (londiff2 * latdiff1 - latdiff2 * londiff1);
                    var segtest2 = (londiff2 * (seg1.lat() - statesobj[i].values[j].lat()) + latdiff2 * (statesobj[i].values[j].lng() - seg1.lng())) / (latdiff2 * londiff1 - londiff2 * latdiff1);
                    if (segtest1 >= 0 && segtest1 <= 1 && segtest2 >= 0 && segtest2 <= 1) {
                        intersections++;
                    }
                }
            }
            if (intersections % 2 == 1) {
                alert("circle contains: " + statesobj[i].name);
                break; // once find one point of state within a circle don't need to test the rest
            }
        }
    }
}
  • 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-23T21:34:01+00:00Added an answer on May 23, 2026 at 9:34 pm

    One thing that an alert does is that it creates a delay beacuse you have to click the frikkin’ button. If the code after the alert got dependency on a completed ajax call, the ajax might be done in time beacuse the code was delayed by the alert, amirite?

    ajax call (taking 200ms)
    
    alert (takes 1000ms to click)
    
    some more code exepecting ajax to be complete
    

    This scenario will fail if there is no alert

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sometimes JavaScript doesn't make sense to me, consider the following code that generates a
I'm seeing a lot of answers on StackOverflow that say that JavaScript executes code
This is my jQuery AJAX code and this javascript file is placed in C:\workspace\search-ui\search-ui\src\main\webapp\themes\client\javascript\agile.js
I am trying to create a JavaScript object that will deal with all of
inside a user control I have placed: <script type=text/javascript> $(function () { alert(foooo); };
In javascript I create divs that are placed on the page. I get the
First of all let me say thank you to everyone that offered answers...I have
I am using an embedded flash movie in my web page. I would like
My .php code in a file fetchvalues.php looks like this: echo json_encode(array($PostedDate.Places.$Company.$Designation.$ProjectDetails.$DesiredCandidate.$HRName.$HRContact.$Email)); This file
I developed an application that interfaces with an institution's emergency alert system. How it

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.