Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVASCRIPT Help I have a 2d array that has 9 arrays with 9 elements in each array. [[0,0,0,0,8,0,4,6,1],[0,9,8,0,0,3,0,0,0],[0,0,0,0,0,0,0,0,0],[0,7,0,0,5,4,8,1,0], [2,0,0,0,0,0,0,4,0],[1,0,5,0,0,0,0,0,0],[0,5,0,0,0,7,3,0,2],[0,0,2,0,0,0,0,7,0],[0,0,0,0,6,0,0,0,0]]; I need to get the first

JAVASCRIPT Help

I have a 2d array that has 9 arrays with 9 elements in each array.

[[0,0,0,0,8,0,4,6,1],[0,9,8,0,0,3,0,0,0],[0,0,0,0,0,0,0,0,0],[0,7,0,0,5,4,8,1,0], [2,0,0,0,0,0,0,4,0],[1,0,5,0,0,0,0,0,0],[0,5,0,0,0,7,3,0,2],[0,0,2,0,0,0,0,7,0],[0,0,0,0,6,0,0,0,0]];

I need to get the first three elements out of 3 arrays at a time and create another 2d array with that. This would look like [0,0,0,0,9,8,0,0,0], [0,8,0,0,0,3,0,0,0],[4,6,1,0,0,0,0,0,0] for the first 3. If you think of the initial 2d array like a 9x9 matrix, I need to create 9, 3x3 boxes starting in the top left, going to the right, then the middle left, middle right, bottom, left, bottom right.

I need a function that changes that initial array into the new one as described. In JavaScript.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

What were the main characteristics of the Brady Plan?

Answered: 1 week ago