Created
November 19, 2015 02:12
-
-
Save varavut/06602f3e18f8e22d8d19 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 'R' is red cube | |
// 'Y' is yellow cube | |
var data = [ | |
['Y','Y','R'], | |
['Y','R'], | |
['R'], | |
['R'], | |
['Y','R'], | |
['Y','Y','R'] | |
] | |
var result = data.map(function(item){ | |
return item.map(function(block){ | |
return block == 'Y'? 'R' : block; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment