0๐
โ
['a', 'b', 'c'].reduceRight((nest, key) => ({ [key]: nest }), {});
// { a: { b: { c: {} } } }
Source:stackexchange.com
0๐
['a', 'b', 'c'].reduceRight((nest, key) => ({ [key]: nest }), {});
// { a: { b: { c: {} } } }