Skip to content

Instantly share code, notes, and snippets.

@NV
Created October 23, 2009 14:01
Show Gist options
  • Save NV/216899 to your computer and use it in GitHub Desktop.
Save NV/216899 to your computer and use it in GitHub Desktop.
function source_of (array, up_to_dimension) {
// Your implementation
}
source_of([1, [2, [3]]], 0) == '[1, ?]'
source_of([1, [2, [3]]], 1) == '[1, [2, ?]]'
source_of([1, [2, [3]]], 2) == '[1, [2, [3]]]'
source_of([532, 94, [13, [41, 0]], [], 49], 0) == '[532, 94, ?, ?, 49]'
/*
Function must work at least in latest versions of Firefox, Opera, Safari and IE.
You must not use regexps. Performance really important issue.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment