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 7822641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:58:42+00:00 2026-06-02T07:58:42+00:00

I have the following function (taken from Elevation Service @ Google Maps API )

  • 0

I have the following function (taken from Elevation Service @ Google Maps API) which output for example 63.00425720214844 when I click somewhere on the map I have created with Google Maps JavaScript API v3:

function getElevation(event) {
    var locations = [];
    var clickedLocation = event.latLng;
    locations.push(clickedLocation);

    var positionalRequest = {
        'locations': locations
    }

    elevator.getElevationForLocations(positionalRequest, function(results, status) {
        if(status == google.maps.ElevationStatus.OK) {
            var s = results[0].elevation
            if(results[0]) {
                alert(s.substring(0, s.indexOf('.') - 1));
            } else {
                alert('Inget resultat hittades');
            }
        } else {
            alert('Det gick inte att hitta höjdskillnaden på grund av följande: ' + status);
        }
    });
}

I want to remove everything after the dot including the dot, for example remove .00425720214844 from 63.00425720214844 but when I click somewhere on the map, I’m getting this error message in the console: Uncaught TypeError: Object 63.00425720214844 has no method 'indexOf'.

What have I done wrong?

Thanks in advance.

  • 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-06-02T07:58:45+00:00Added an answer on June 2, 2026 at 7:58 am

    Just do a javascript parseInt(63.00425720214844) to get 63.

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

Sidebar

Related Questions

The following example is taken from: http://php.net/manual/en/function.curl-multi-close.php#example-3540 This example will create two cURL handles,
I have the following code taken from cplusplus.com : // set_terminate example #include <iostream>
We have the following example table (actually taken from another example here on stackoverflow...)
I have a for-loop which performs the following function: Take a M by 8
I have the following function to get an int from a high-byte and a
I have the following Django Model which retrieves 3 records from a database. The
I have the following queue class (taken from wordpress): #include<iostream.h> class Queue { private:
I have the following C code to copy a linked list(taken from Stanford CS
I have taken following code from my template file, <a onclick=previewPop('<?= $this->url(array('controller'=>'report', 'action'=>'generatepreview','report_date'=>str_replace(%2F, /,
I have a function named OpenAccount() which takes in the details from the User

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.