Consistent performance of function with the JS mathematical calculations



  • Hey, everybody, there's no way we can figure out an algorithm in which we're going to be able to perform our functions consistently. There's a mass (two-dimensional) to which all the functions from another body should be applied.

    Details: we have a matrix with which the following actions may be taken (transponse, stoppage, stop poles, stop areas), number of actions for example 10, so asynchronous, functions are performed immediately and the matrix is broken, and a new action is to be taken at the end of each action.

    var useNetwork = [] //матрица со стороной 9х9
    var fL = [
            function(){
                        //transponding
                if(debug)
                console.log('transponding start');
                for(i=0;i<9;i++){
                    for(j=0;j<9;j++){
                        useNetwork[j][i] = useNetwork[i][j];
                    }
                }
    
            if(debug)
            console.log('transponding end');
    
        },
        function(){
    
            console.log('second');
        },
        function(){
    
            console.log('third');
        },
        function(){
    
            console.log('fourth');
        }
    ];
    

    for(i=0;i<10;i++){
    nameOfFunction = fL[parseInt(Math.random() * (4 - 0) + 0)];
    nameOfFunction();

    }

    In the console the following

    index.html:246 fourth
    index.html:225 transponding start
    index.html:233 transponding end



  • I've taken my silver plaster from the shelf and I've seen what's on the educational channel. I bet your code will work when you add it to all your cycles. var In front of the counter.

    for(var i=0;i<10;i++){
      ...
    }
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2