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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:26:29+00:00 2026-06-11T10:26:29+00:00

function f() { var b = b; return function() { alert(b); return b; };

  • 0
function f() {
    var b = "b";
    return function() {
        alert(b);
        return b;
    };
}
var a = function f();
    alert(a);
​

I try to run this code but I have error which I don’t understand.

Error:
Problem at line 8 character 21: Expected '{' and instead saw ';'.
var a = function f();

Problem at line 8 character 21: Unnecessary semicolon.
var a = function f();

Problem at line 8 character 22: Missing semicolon.
var a = function f();

Implied global: alert 4,9

what wrong in this code I want to alert the the privete var from the global scope.
what I should change ?
Many thx.
​

  • 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-11T10:26:30+00:00Added an answer on June 11, 2026 at 10:26 am
     var a = function f();
    

    That doesn’t make any sense.
    If you’re trying to call the function, just write f().

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

Sidebar

Related Questions

This javascript code run without problem in chrome and IE but have a problem
$(a.close).click(function() { var id = $(this).attr(id); alert(id); $(this).parents(div.venue:first).fadeOut(Fast); return false; }); Any ideas why
I have this code, which is working fine in FireFox, chrome and IE8 but
var Dog = function() { var _instance = 'hello world'; return function() { console.log(this._instance);
For example: (function() { var proxied = window.eval; window.eval = function() { return proxied.apply(this,
This seems like a straightforward implementation: ko.observableArray.fn.findEl = function(id) { return ko.computed(function() { var
I find myself doing this repeatedy. $jq(button).filter(function(){ return this.id.match(/^user_(\d+)_edit$/); }).click(function(){ var matches = this.id.match(/^user_(\d+)_edit$/);
searchVersion: function (dataString) { var index = dataString.indexOf(this.versionSearchString); if (index == - 1) return;
Here is my code: function currentCursPos(){ $(document).mousemove(function(e){ var pos= {"x":e.pageX,"y":e.pageY}; return pos }); }
I have problem with xhr open() method. My code follows : var xmlhttp=false; if(!xmlhttp)

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.