SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2009
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    function declaration syntax i don't understand

    hi

    I'm looking at a JavaScript code that has a function with the following syntax:

    Code:
    function validate_mod_resource_mod_form_reference[value](element) {
    	.
    }
    you see the "[value]" there? is that valid?

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,192
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Where did you see this been done as there is no way you use an array reference on a function that's not a prototype of the Object family

  3. #3
    Non-Member Max Height's Avatar
    Join Date
    Dec 2011
    Posts
    303
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by remonkal View Post
    you see the "[value]" there? is that valid?
    It would be interesting to see a line of code where that "function" is actually called.

  4. #4
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,192
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Max Height View Post
    It would be interesting to see a line of code where that "function" is actually called.
    You wouldn't even be able to call the function because an error would be thrown when declaring the function.

  5. #5
    Non-Member Max Height's Avatar
    Join Date
    Dec 2011
    Posts
    303
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by chris.upjohn View Post
    You wouldn't even be able to call the function because an error would be thrown when declaring the function.
    That's what I thought as well and hence my curiosity to see how the function was even called in the op's code since he/she said

    I'm looking at a JavaScript code....................................


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •