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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:50:02+00:00 2026-06-02T16:50:02+00:00

I am making an app in ruby on rails and this is one of

  • 0

I am making an app in ruby on rails and this is one of my coffeescript files
I believe that my code is indented properly but I am still getting an error.
I marked the line that is giving me error with comment below.
Please help!

jQuery ->


    today_date = new Date()
    month = today_date.getMonth()
    day = today_date.getDay()


    pkpstyle= [
        featureType: "landscape.natural"
        elementType: "geometry"
        stylers: [
            lightness: -29
        ,
            hue: "#ffee00"
        ,
            saturation: 54
         ]
    ,
        featureType: "poi.park"
        stylers: [
            lightness: -35
        ,
            hue: "#005eff"
         ]
    ,
        featureType: "road.arterial"
    ,
        featureType: "road.arterial"
        stylers: [ lightness: 45 ]
     ]


    tempDay = 4
    //I get an error here saying Uncaught TypeError: undefined is not a function
    today_latlng = getLatlng(stops[tempDay])

    markericon = new google.maps.MarkerImage("/assets/cycling.png")
    myOptions =
        center: today_latlng
        zoom: 12
        minZoom: 4
        styles: pkpstyle
        mapTypeId: google.maps.MapTypeId.ROADMAP

    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions)
    for i of stops
        latlng = getLatlng(stops[i].latlng)
        marker = new google.maps.Marker(
            map: map
            icon: markericon
            position: latlng
        )

    getLatlng = (loc) ->
        loc_split = loc.split(", ")
        lat = loc_split[0]
        lng = loc_split[1]
        new google.maps.LatLng(lat, lng)
  • 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-02T16:50:05+00:00Added an answer on June 2, 2026 at 4:50 pm

    This CoffeeScript:

    today_latlng = getLatlng(stops[tempDay])
    getLatlng = (loc) ->
        loc_split = loc.split(", ")
        lat = loc_split[0]
        lng = loc_split[1]
        new google.maps.LatLng(lat, lng)
    

    Is, more or less, the same as this JavaScript:

    var today_latlng, getLatLng;
    today_latlng = getLatLng(stops[tempDay])
    getLatLng = function(loc) { ... };
    

    So you do have a getLatLng variable when you getLatLng(stops[tempDay]) but you’re not assigning it a value until after you try to call it as a function. You need to define getLatLng as a function before you treat it as one:

    getLatlng = (loc) ->
        loc_split = loc.split(", ")
        lat = loc_split[0]
        lng = loc_split[1]
        new google.maps.LatLng(lat, lng)
    #...
    today_latlng = getLatlng(stops[tempDay])
    

    Also, if stops is an array then you shouldn’t use an of loop, you should use an in loop:

    for p in stops
        latlng = getLatlng(p.latlng)
        #...
    

    An of loop is the same as a for ... in JavaScript loop and that can do funny things with an array, an in loop ends up as a for(;;) loop in the JavaScript and that’s well behaved with arrays. I don’t know what stops is though so this might not apply, I’m just guessing based on how it is being used and the i index variable.

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

Sidebar

Related Questions

I have a Rails 3rc app on Ruby 1.9.2 that works fine, but Bundler
I am making an app that will play sound on events but I can't
I am making a web app that will process large files (1gb+). While the
I am currently using rails 3.0.7 and ruby 1.9.2 and making a rails App
I'm making a rails app that handles many, many posts. What i want to
I am making a Ruby on Rails app and am having trouble setting some
I am making a Ruby on Rails app and I need to be able
I am making Ruby On Rails 3.0.3 app with JQuery 1.4.4 and jQuery UJS
So I'm making a rails app that also utilizes node.js for realtime features. What
I am making my first app in Ruby on Rails 3.1....Do I have these

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.