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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:41:42+00:00 2026-06-15T09:41:42+00:00

I’m looking at some code from EcmaScript.NET and in particular, I’m looking at the

  • 0

I’m looking at some code from EcmaScript.NET and in particular, I’m looking at the definitions in FunctionNode.cs. They’ve provided a relatively descriptive comment above the definitions, but I’m not sure what would my example below qualify as:

/// <summary>
/// There are three types of functions that can be defined. The first
/// is a function statement. This is a function appearing as a top-level
/// statement (i.e., not nested inside some other statement) in either a
/// script or a function.
///
/// The second is a function expression, which is a function appearing in
/// an expression except for the third type, which is...
///
/// The third type is a function expression where the expression is the
/// top-level expression in an expression statement.
///
/// The three types of functions have different treatment and must be
/// distinquished.
/// </summary>
public const int FUNCTION_STATEMENT = 1;
public const int FUNCTION_EXPRESSION = 2;
public const int FUNCTION_EXPRESSION_STATEMENT = 3;

Here is what I’m roughly seeing:

<script>
(function(){document.write("The name is Bond, ")})(),
(function(){document.write("James Bond.")})()
</script>

Would this qualify as a FUNCTION_STATEMENT, FUNCTION_EXPRESSION, FUNCTION_EXPRESSION_STATEMENT?

Update

I guess my question is about the role of the comma:

// Expression
(function(){ document.write('Expression1<br>'); })();
(function(){ document.write('Expression2<br>'); })();

// Expression
var showAlert=function(){ document.write('Expression3<br>'); };
showAlert();

// Declaration
function doAlert(){ document.write('Declaration<br>'); }
doAlert();

// What about this?
(function(){ document.write('What about'); })(), // <-- Note the comma
(function(){ document.write(' this?<br>'); })();

// And now this? 
var a = ((function(){ return 1; })(), // <-- Again, a comma
(function(){ return 2; })());
document.write("And now this? a = " + a);

What are the last two? Expressions or Expression Statements?

  • 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-15T09:41:43+00:00Added an answer on June 15, 2026 at 9:41 am

    Don’t know about EcmaScript.NET, but from my understanding all those functions are function expressions. They are part of a IIFE-invocation, which again is part of a comma-operator expression – in no way “top-level“.

    I’d say that the third type are function statements where they are not allowed syntactically, like

    if (false) {
        function doSomething() {…}
    }
    

    Check out Kangax’ famous article about named function expressions, where their behaviour across engines is summed up (e.g. Gecko’s function statements).

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Does anyone know how can I replace this 2 symbol below from the string

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.