www.webdeveloper.com
Results 1 to 2 of 2

Thread: Argument property question

  1. #1
    Join Date
    Apr 2012
    Posts
    47

    resolved [RESOLVED]Argument property question

    I need to modify the pad_lef function so it uses the arguments property to get the first two arguments that are passed to it. Here is my code for that function:

    Code:
    var pad_left = function(text, width, pad) {
        if ( arguments.length < 2 || arguments.length > 3 ) {
            return "";
        }
        if ( arguments.length == 2 ) {
            pad = " ";
        }
        var result = text.toString();
        while ( result.length < width ) {
            result = pad + result;
        }
        return result;
    }
    Obviously new to this so appreciate any and all help. Thanks.
    Last edited by Tullamore; 04-18-2012 at 05:08 PM. Reason: figured out

  2. #2
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,633
    pad_left.arguments.length
    xxx: Guess Buddhist riddle: "What is the sound of one hand clapping?"
    yyy: facepalm

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