Last active
August 29, 2015 14:01
-
-
Save antyakushev/7937f3c86500217e67d7 to your computer and use it in GitHub Desktop.
This file contains 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
//Напишите на JavaScript код, превращающий строку 'a.b.c.d' в объект {a: {b: {c: 'd'}}} | |
function pto(path) { | |
var p=path.split('.'),o=p.pop(),c,k; | |
while (k = p.pop()) {c={};c[k]=o;o=c;} | |
return o | |
} | |
// Sergey Chikuyonok |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment