Skip to content

Instantly share code, notes, and snippets.

@markrowi
Last active June 13, 2019 03:26
Show Gist options
  • Select an option

  • Save markrowi/35956a79e6922a39cd8f7d22774b7fa5 to your computer and use it in GitHub Desktop.

Select an option

Save markrowi/35956a79e6922a39cd8f7d22774b7fa5 to your computer and use it in GitHub Desktop.
example of recursion - Lower case all text in a object
recur = (val) => {
let temp = {}
for(const i of Object.keys(val)) {
temp[i] = typeof val[i]==='object' ? recur(val[i]) : val[i].toLowerCase();
}
return temp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment