Skip to content

Instantly share code, notes, and snippets.

@Anthonyzou
Last active January 27, 2019 20:19
Show Gist options
  • Select an option

  • Save Anthonyzou/9bee8bcbf1ccf1558293d9343b6b80e0 to your computer and use it in GitHub Desktop.

Select an option

Save Anthonyzou/9bee8bcbf1ccf1558293d9343b6b80e0 to your computer and use it in GitHub Desktop.
var a = [
'Do',
[
'th',
[
'rab',
[
'ho',
[
'w',
[
'g',
[
'whe',
['w', ['st', ['Fact', ['knows.'], 'orio'], 'op'], 'e'],
're',
],
'o',
],
'e',
],
'le',
],
'bit',
],
'e',
],
'wn',
];
var b = (args) => {
if(Array.isArray(args)){
const [first, second, third] = args
const result = `${first}${third||''} ${second ? b(second) : ''}`
return result
}
return args
}
console.log(b(a))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment