This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Marc Krenn
Posted Oct 21 - Read on Facebook

What's the best practice for accessing elements within a two-dimensional arrays?

Here's an example ( in which the clicked layer gets switched with a random layer from a pseudo-2D array.

It works fine using this pretty simple, yet inelegant method of (simply put) multiplying and adding rows to columns, but there must be a better way to do this in coffeescript ... I suspect by using .map!? Can anyone give me a hint how this example would work with .map (especially the part where a random layer is picked from the array).



Koen Bok

Looking through the code, this looks pretty much like how I would do it. I think it looks pretty clean.

Koen Bok

Is there anything specific that bothers you about the code? Maybe I'm overlooking something.

Read the entire post on Facebook