Node Js Developer Interview Questions

930 node js developer interview questions shared by candidates

Coding questions in technical rounds like 2 sum and find frequency, and questions related to nodejs, in second technical round he told me to built a simple nodejs application with mysql db setup and all crud operation
avatar

Senior Node Js Developer

Interviewed at Tricon Infotech

4.4
May 30, 2024

Coding questions in technical rounds like 2 sum and find frequency, and questions related to nodejs, in second technical round he told me to built a simple nodejs application with mysql db setup and all crud operation

Write a function that will recursively merge two objects with the following conditions: 1.) If a[field] is an array, and b[field] is defined and is not an array, add b[field] to the array 2.) If a[field] is an array an b[field] exists but is undefined or null, set a[field] to an empty array 3.) If a[filed] is an array and b[field] is an array, set a[field] to b[field] 4.) If a[field] exists and b[field] exists but is undefined, delete a[field] 5.) If b[field] is a non-complex type (number, string, boolean, et cetera), copy to a[field] Example: var a = { first_name: 'Bob', last_name: 'Joness', email: 'bob@gmail.com', address: { line_1: '1234 Main St', line_2: 'Apt 413', city: 'Los Angeles', state: 'CA', zip: '90048' }, logins: [ { date: '10/22/2012', ip: '192.168.0.1' }, { date: '10/21/2012', ip: '192.168.0.1' } ], photos: [ 'IMG-1985.jpg', 'IMG-1987.jpg' ] } var b = { last_name: 'Jones', active: true, address: { line_1: '2143 South Main St', line_2: undefined }, logins: { date: '10/23/2012', ip: '192.168.0.1' }, photos: undefined } Result: { first_name: 'Bob', last_name: 'Jones', active: true, email: 'bob@gmail.com', address: { line_1: '2143 South Main St', city: 'Los Angeles', state: 'CA', zip: '90048' }, logins: [ { date: '10/22/2012', ip: '192.168.0.1' }, { date: '10/21/2012', ip: '192.168.0.1' }, { date: '10/23/2012', ip: '192.168.0.1' } ], photos: [] } Assumptions: 1.) You can assume you are working in node; e.g. you have access to array methods such as .some and .forEach, and you do not have to worry about browser compatibility issues 2.) You do not have access to utilities such as lodash or underscore
avatar

Senior Node JS Developer

Interviewed at GlobalLogic

3.8
Jun 19, 2022

Write a function that will recursively merge two objects with the following conditions: 1.) If a[field] is an array, and b[field] is defined and is not an array, add b[field] to the array 2.) If a[field] is an array an b[field] exists but is undefined or null, set a[field] to an empty array 3.) If a[filed] is an array and b[field] is an array, set a[field] to b[field] 4.) If a[field] exists and b[field] exists but is undefined, delete a[field] 5.) If b[field] is a non-complex type (number, string, boolean, et cetera), copy to a[field] Example: var a = { first_name: 'Bob', last_name: 'Joness', email: 'bob@gmail.com', address: { line_1: '1234 Main St', line_2: 'Apt 413', city: 'Los Angeles', state: 'CA', zip: '90048' }, logins: [ { date: '10/22/2012', ip: '192.168.0.1' }, { date: '10/21/2012', ip: '192.168.0.1' } ], photos: [ 'IMG-1985.jpg', 'IMG-1987.jpg' ] } var b = { last_name: 'Jones', active: true, address: { line_1: '2143 South Main St', line_2: undefined }, logins: { date: '10/23/2012', ip: '192.168.0.1' }, photos: undefined } Result: { first_name: 'Bob', last_name: 'Jones', active: true, email: 'bob@gmail.com', address: { line_1: '2143 South Main St', city: 'Los Angeles', state: 'CA', zip: '90048' }, logins: [ { date: '10/22/2012', ip: '192.168.0.1' }, { date: '10/21/2012', ip: '192.168.0.1' }, { date: '10/23/2012', ip: '192.168.0.1' } ], photos: [] } Assumptions: 1.) You can assume you are working in node; e.g. you have access to array methods such as .some and .forEach, and you do not have to worry about browser compatibility issues 2.) You do not have access to utilities such as lodash or underscore

Viewing 901 - 910 interview questions

Glassdoor has 930 interview questions and reports from Node js developer interviews. Prepare for your interview. Get hired. Love your job.