www.webdeveloper.com
Results 1 to 3 of 3

Thread: object function cannot work

  1. #1
    Join Date
    Nov 2011
    Posts
    64

    object function cannot work

    Code:
    <script language="JavaScript1.2">
        var mul = function Multiply (x, y) {
        return (x * y);
    }
    mul(3,4);
    </script>

    I was wondering why it can't work?

  2. #2
    Join Date
    Feb 2006
    Posts
    2,927
    The function returns the product of the two arguments-
    if you want to do something with that value, you have to specify what.



    Code:
    <script>
        var mul = function Multiply (x, y) {
        return (x * y);
    }
    alert(mul(3,4));
    //or
    alert(mul)
    </script>

  3. #3
    Join Date
    Nov 2011
    Posts
    64
    Thk you

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles