smiling person with a cap

Alexander Atamanyuk

Javascript Developer

Skills

  • HTML

  • CSS

  • Javascript

  • Git

  • PUG

  • SCSS

  • Gulp

  • NodeJS

Languages

About me

Currently I work part-time as a system administrator in a construction company. My goals are to expand my knowledge in computer science and gain a deep understanding of web technologies. I strive to become a competent frontend developer. Thats why I finished a layout designer course on hexlet.io, and now I’m taking the frontend-developer course at rsschool

Courses

  • Hexlet - Layout Design (Completed)

    hexlet progress
  • Hexlet - Frontend Developer (In progress)

  • Hexlet - JS Backend Developer (In progress)

  • RSSchool - Frontend Developer Pre School (In progress)

Code Example

Task

            
              convert([]); 
              // {}
              convert([['key', 'value']]);
              // { key: 'value' }
              convert([['key', 'value'], ['key2', 'value2']]);
              // { key: 'value', key2: 'value2' }
              convert([
                ['key', [['key2', 'anotherValue']]],
                ['key2', 'value2']
              ]);
              // { key: { key2: 'anotherValue' }, key2: 'value2' }
            
          

Solution

            
              const convert = (arr) => arr.reduce((acc, [key, value]) => {
                if (!Array.isArray(value)) {
                  acc[key] = value;
                } else {
                  acc[key] = convert(value);
                }
                return acc;
              }, {});
              
              export default convert;