Skip to content

Instantly share code, notes, and snippets.

@varavut
Created November 19, 2015 02:12
Show Gist options
  • Save varavut/06602f3e18f8e22d8d19 to your computer and use it in GitHub Desktop.
Save varavut/06602f3e18f8e22d8d19 to your computer and use it in GitHub Desktop.
// '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