Skip to content

Instantly share code, notes, and snippets.

@anabastos
Created March 17, 2017 19:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anabastos/4014c329a0852b7aa9062606e210a9ab to your computer and use it in GitHub Desktop.
Save anabastos/4014c329a0852b7aa9062606e210a9ab to your computer and use it in GitHub Desktop.
Desafio map -js4girls
//tendo uma matrix 4x4 multiplicar apenas os valores pares
var matrix = [
[1, 11, 32],
[13, 14, 15],
[7, 6, 2]
]
//resultado esperado:
// [
// [1, 11, 64],
// [13, 28, 15],
// [7, 12, 4]
// ]
@neoandrevictor
Copy link

`

<title>Tendo uma matrix 4x4 dobrar apenas os valores pares</title> <script>
    function main(){

        var matrix = [
            [1, 11, 32],
            [13, 14, 15],
            [7, 6, 2]
            ];

        for(i=0;i<matrix.length;i++){

            for (j=0;j<matrix[i].length;j++){

                if (matrix[i][j]%2==0){

                    matrix[i][j]=matrix[i][j]*2;


                }


            }


        }

        document.write(matrix);


    }


</script>
`

@neoandrevictor
Copy link

`

<title>Tendo uma matrix 4x4 dobrar apenas os valores pares</title> <script>
    function main(){

        var matrix = [
            [1, 11, 32],
            [13, 14, 15],
            [7, 6, 2]
            ];

        for(i=0;i<matrix.length;i++){

            for (j=0;j<matrix[i].length;j++){

                if (matrix[i][j]%2==0){

                    matrix[i][j]=matrix[i][j]*2;


                }


            }


        }

        document.write(matrix);


    }


</script>
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment