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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:19:02+00:00 2026-06-17T09:19:02+00:00

Here’s what I want to see: kango.invokeAsync(‘kango.storage.getItem’, ‘item1’, function(returned1) { kango.invokeAsync(‘kango.storage.getItem’, ‘item2’, function(returned2) {

  • 0

Here’s what I want to see:

kango.invokeAsync('kango.storage.getItem', 'item1', function(returned1) {
    kango.invokeAsync('kango.storage.getItem', 'item2', function(returned2) {
        alert(returned1 + returned2);
    });
});

Here’s what I wrote in coffeescript:

kango.invokeAsync 'kango.storage.getItem', 'item1', (returned1) ->

  kango.invokeAsync 'kango.storage.getItem', 'item2', (returned2) ->

    alert returned1 + returned2

The problem here is that no matter what, coffeescript is making the function ()-> return something. In that case, the last statement is being returned for some reason.

If I were to place a second alert in the nested function with returned2, it would return instead of the first one:

kango.invokeAsync('kango.storage.getItem', 'item1', function(returned1) {
    kango.invokeAsync('kango.storage.getItem', 'item2', function(returned2) {
      alert(returned1 + returned2);
      return alert('something');
    });

How to have it avoid doing the return?

  • 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-17T09:19:02+00:00Added an answer on June 17, 2026 at 9:19 am

    If you don’t want a function to return something then just say return:

    kango.invokeAsync 'kango.storage.getItem', 'item1', (returned1) ->
      kango.invokeAsync 'kango.storage.getItem', 'item2', (returned2) ->
        alert returned1 + returned2
        return
    

    return behaves the same in CoffeeScript as it does in JavaScript so you can say return if you don’t want any particular return value.

    If you don’t specify an explicit return value using return, a CoffeeScript function will return the value of the last expression so your CoffeeScript is equivalent to:

    kango.invokeAsync 'kango.storage.getItem', 'item1', (returned1) ->
      kango.invokeAsync 'kango.storage.getItem', 'item2', (returned2) ->
        return alert returned1 + returned2
    

    The result will be the same though, alert doesn’t return anything so:

    f = ->
        alert 'x'
        return
    x = f()
    

    will give undefined in x but so will this:

    f = -> alert 'x'
    x = f()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the code in a function I'm trying to revise. This example works
Here is the Javascript I currently have <script type=text/javascript> $(function() { $('.slideshow').hover( function() {
Here are my functions: function dropmenu() { $(.dropdownitem).show('slow'); } function hidemenu() { $(.dropdownitem).hide('slow'); }
Here's my situation. I have a DotNetNuke application. I want to link to an
Here is my function: function reCalculate(i) { document.getElementById(Q + i).value = document.getElementById(C + i).value
Here's the situation, i want to have a user that can enter time on
Here's my test function (c#, visual studio 2010): [TestMethod()] public void TestGetRelevantWeeks() { List<sbyte>
Here is my demo code I want to disable td with this content 'CLICKING
Here is my code <?php function random_id() { $chars = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $id = '';
Here are two ways of setting context: $.proxy(function() { this.doStuff(); }, this); ... var

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.