Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. JavaScript
  4. Java Script Question

Java Script Question

Scheduled Pinned Locked Moved JavaScript
questionjavajavascripthtmldata-structures
26 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hakan Bulut
    wrote on last edited by
    #1

    <html>
    <head>
    <script language="JavaScript">
    function myFunction(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10)
    {
    var arrNums=new Array(10);
    console.log(Array.isArray(arrNums));

    var str=document.writeln("myFunction\[arrNums\]")
         document.this.result.value=str;
    
    for(var i=0; i<10; i++)
        str=myFunction(arrNums\[i\]);
    

    document.write(str)

    }
    </script>
    </head>
    <body>

    </body>
    </html>

    In where is the error?

    L D M 4 Replies Last reply
    0
    • H Hakan Bulut

      <html>
      <head>
      <script language="JavaScript">
      function myFunction(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10)
      {
      var arrNums=new Array(10);
      console.log(Array.isArray(arrNums));

      var str=document.writeln("myFunction\[arrNums\]")
           document.this.result.value=str;
      
      for(var i=0; i<10; i++)
          str=myFunction(arrNums\[i\]);
      

      document.write(str)

      }
      </script>
      </head>
      <body>

      </body>
      </html>

      In where is the error?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You have not explained what you are trying to do. However, at a guess, I would suspect the recursive call str=myFunction(arrNums[i]);.

      Use the best guess

      H 1 Reply Last reply
      0
      • H Hakan Bulut

        <html>
        <head>
        <script language="JavaScript">
        function myFunction(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10)
        {
        var arrNums=new Array(10);
        console.log(Array.isArray(arrNums));

        var str=document.writeln("myFunction\[arrNums\]")
             document.this.result.value=str;
        
        for(var i=0; i<10; i++)
            str=myFunction(arrNums\[i\]);
        

        document.write(str)

        }
        </script>
        </head>
        <body>

        </body>
        </html>

        In where is the error?

        D Offline
        D Offline
        dusty_dex
        wrote on last edited by
        #3

        where is the 'result' ? no <form> or variable called result in the web page.

        Q. Hey man! have you sorted out the finite soup machine? A. Why yes, it's celery or tomato.

        1 Reply Last reply
        0
        • L Lost User

          You have not explained what you are trying to do. However, at a guess, I would suspect the recursive call str=myFunction(arrNums[i]);.

          Use the best guess

          H Offline
          H Offline
          Hakan Bulut
          wrote on last edited by
          #4

          I had to tried pass and assing an array variables to array values. This function should returning a value?

          L 1 Reply Last reply
          0
          • H Hakan Bulut

            I had to tried pass and assing an array variables to array values. This function should returning a value?

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            See http://www.w3schools.com/js/js_datatypes.asp[^].

            Use the best guess

            H 1 Reply Last reply
            0
            • L Lost User

              See http://www.w3schools.com/js/js_datatypes.asp[^].

              Use the best guess

              H Offline
              H Offline
              Hakan Bulut
              wrote on last edited by
              #6

              Ok. It is so simple. How does it possible in javascript language an array elements variables inside itself to array values assinging. This function should returning a value? That is.. How much possibilities to an array unit setup on javascript language.

              L 1 Reply Last reply
              0
              • H Hakan Bulut

                Ok. It is so simple. How does it possible in javascript language an array elements variables inside itself to array values assinging. This function should returning a value? That is.. How much possibilities to an array unit setup on javascript language.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Why not follow the suggestions on the link I gave you and read on to the next pages? There you will find examples of arrays, functions with arguments, and functions that return values.

                Use the best guess

                M 1 Reply Last reply
                0
                • L Lost User

                  Why not follow the suggestions on the link I gave you and read on to the next pages? There you will find examples of arrays, functions with arguments, and functions that return values.

                  Use the best guess

                  M Offline
                  M Offline
                  Manfred Rudolf Bihy
                  wrote on last edited by
                  #8

                  Did you understand what OP is trying to say? I'm dumbfounded and cannot comprehend at all what OP is trying to do. :^)

                  "I had the right to remain silent, but I didn't have the ability!"

                  Ron White, Comedian

                  L 1 Reply Last reply
                  0
                  • M Manfred Rudolf Bihy

                    Did you understand what OP is trying to say? I'm dumbfounded and cannot comprehend at all what OP is trying to do. :^)

                    "I had the right to remain silent, but I didn't have the ability!"

                    Ron White, Comedian

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    1. Not really, but based on the thread it's something to do with Javascript arrays. 2. I don't really understand the last question but I think he just needs to run through the W3C tutorial.

                    Use the best guess

                    M 1 Reply Last reply
                    0
                    • L Lost User

                      1. Not really, but based on the thread it's something to do with Javascript arrays. 2. I don't really understand the last question but I think he just needs to run through the W3C tutorial.

                      Use the best guess

                      M Offline
                      M Offline
                      Manfred Rudolf Bihy
                      wrote on last edited by
                      #10

                      1. That much is clear! 2. I'm relieved, I thought you understood what OP was on about. :)

                      "I had the right to remain silent, but I didn't have the ability!"

                      Ron White, Comedian

                      L 1 Reply Last reply
                      0
                      • M Manfred Rudolf Bihy

                        1. That much is clear! 2. I'm relieved, I thought you understood what OP was on about. :)

                        "I had the right to remain silent, but I didn't have the ability!"

                        Ron White, Comedian

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #11

                        Looking at his profile, I think he's a countryman of yours; although may be from Turkey originally.

                        Use the best guess

                        M H 4 Replies Last reply
                        0
                        • L Lost User

                          Looking at his profile, I think he's a countryman of yours; although may be from Turkey originally.

                          Use the best guess

                          M Offline
                          M Offline
                          Manfred Rudolf Bihy
                          wrote on last edited by
                          #12

                          Whilst the text in his profile may appear to be in German, I have a strong gut feeling that it is the product of google translate. Most of the sentences aren't complete and the meaning is obscure. :)

                          "I had the right to remain silent, but I didn't have the ability!"

                          Ron White, Comedian

                          1 Reply Last reply
                          0
                          • H Hakan Bulut

                            <html>
                            <head>
                            <script language="JavaScript">
                            function myFunction(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10)
                            {
                            var arrNums=new Array(10);
                            console.log(Array.isArray(arrNums));

                            var str=document.writeln("myFunction\[arrNums\]")
                                 document.this.result.value=str;
                            
                            for(var i=0; i<10; i++)
                                str=myFunction(arrNums\[i\]);
                            

                            document.write(str)

                            }
                            </script>
                            </head>
                            <body>

                            </body>
                            </html>

                            In where is the error?

                            D Offline
                            D Offline
                            dusty_dex
                            wrote on last edited by
                            #13

                            errors: this refers to the window object. And this is my *best guess* as to maybe what you are trying to do.

                            <head>
                            <script language="JavaScript">
                            function myFunction( /* x1,x2,x3,x4,x5,x6,x7,x8,x9,x10 */)
                            {
                            var str = "";
                            var arrNums = []; // new Array(10);

                            var i=0;
                            while(i < arguments.length) {
                               str += arguments\[i\]+" "; // coerce args to string
                               i++;
                            }
                            // update myForm with arguments passed through onload
                            this.document.myForm.result.value=str; 
                            

                            }

                            </script>
                            </head>
                            <body onload="myFunction(1,2,3);">

                            <form name="myForm">

                             <input type="text" name="result" maxlength="80" size="40" value="">
                            

                            </form>

                            </body>
                            </html>

                            your intention was not obvious and I hope this helps you understand some of the changes I made. ;)

                            Q. Hey man! have you sorted out the finite soup machine? A. Why yes, it's celery or tomato.

                            H 2 Replies Last reply
                            0
                            • L Lost User

                              Looking at his profile, I think he's a countryman of yours; although may be from Turkey originally.

                              Use the best guess

                              H Offline
                              H Offline
                              Hakan Bulut
                              wrote on last edited by
                              #14

                              Unfortunately, it's true, but I am rather against organized racism all my hit which the status of the people living here, finally, is necessary to I'm a Turkish if I think got to go first think that once. I have cursed via my profile may be true but it is not tell the Turks that people around the world notorious, so I am is it.

                              Render to Caesar the things that are Caesar's

                              1 Reply Last reply
                              0
                              • D dusty_dex

                                errors: this refers to the window object. And this is my *best guess* as to maybe what you are trying to do.

                                <head>
                                <script language="JavaScript">
                                function myFunction( /* x1,x2,x3,x4,x5,x6,x7,x8,x9,x10 */)
                                {
                                var str = "";
                                var arrNums = []; // new Array(10);

                                var i=0;
                                while(i < arguments.length) {
                                   str += arguments\[i\]+" "; // coerce args to string
                                   i++;
                                }
                                // update myForm with arguments passed through onload
                                this.document.myForm.result.value=str; 
                                

                                }

                                </script>
                                </head>
                                <body onload="myFunction(1,2,3);">

                                <form name="myForm">

                                 <input type="text" name="result" maxlength="80" size="40" value="">
                                

                                </form>

                                </body>
                                </html>

                                your intention was not obvious and I hope this helps you understand some of the changes I made. ;)

                                Q. Hey man! have you sorted out the finite soup machine? A. Why yes, it's celery or tomato.

                                H Offline
                                H Offline
                                Hakan Bulut
                                wrote on last edited by
                                #15

                                Yes.. It is just help! Thx a lot.

                                D 1 Reply Last reply
                                0
                                • L Lost User

                                  Looking at his profile, I think he's a countryman of yours; although may be from Turkey originally.

                                  Use the best guess

                                  H Offline
                                  H Offline
                                  Hakan Bulut
                                  wrote on last edited by
                                  #16

                                  There is a words of Turks. It is: "Bad words by its author."

                                  1 Reply Last reply
                                  0
                                  • L Lost User

                                    Looking at his profile, I think he's a countryman of yours; although may be from Turkey originally.

                                    Use the best guess

                                    H Offline
                                    H Offline
                                    Hakan Bulut
                                    wrote on last edited by
                                    #17

                                    There is a words of Turks. It is: "Bad words by its author."

                                    L 1 Reply Last reply
                                    0
                                    • H Hakan Bulut

                                      There is a words of Turks. It is: "Bad words by its author."

                                      L Offline
                                      L Offline
                                      Lost User
                                      wrote on last edited by
                                      #18

                                      Hakan Bulut wrote:

                                      There is a words of Turks. It is:
                                      "Bad words by its author."

                                      Sorry, but I have no idea what you mean, and your previous message to me was equally impossible to understand. I would suggest you stop using Google translate. Sana Google translate kullanarak durdurmak öneririz.

                                      Use the best guess

                                      H 1 Reply Last reply
                                      0
                                      • L Lost User

                                        Hakan Bulut wrote:

                                        There is a words of Turks. It is:
                                        "Bad words by its author."

                                        Sorry, but I have no idea what you mean, and your previous message to me was equally impossible to understand. I would suggest you stop using Google translate. Sana Google translate kullanarak durdurmak öneririz.

                                        Use the best guess

                                        H Offline
                                        H Offline
                                        Hakan Bulut
                                        wrote on last edited by
                                        #19

                                        The google translate is good at this job, i think so that I thought to right translating up, just as.

                                        L 1 Reply Last reply
                                        0
                                        • H Hakan Bulut

                                          The google translate is good at this job, i think so that I thought to right translating up, just as.

                                          L Offline
                                          L Offline
                                          Lost User
                                          wrote on last edited by
                                          #20

                                          Hakan Bulut wrote:

                                          i think so that I thought to right translating up, just as.(i hakkı gibi, yukarı çevirmeye düşündüm öyle düşünüyorum).

                                          Makes no sense at all, it is just some words thrown together. I suggest you stop wasting your time with it.

                                          Use the best guess

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups