Senior Front End Developer Interview Questions

1,429 senior front end developer interview questions shared by candidates

The object of this exercise is to write a custom JavaScript logger. The only markup needed will be a div with an ID attribute of “result” - where the logger will append its output. Write an object that has the following characteristics: 1. It should be a function that accepts any log level defined at runtime (e.g. debug, warn, etc.) and a corresponding color to apply to the log message (e.g. gray, orange, red, etc.) as arguments. 2. This function should return a new function that takes a message as its argument and appends it to the resultant DOM element. Use this to create loggers for debug, warn, and info levels. 3. Each appended log message should be prepended by the name of its associated level and displayed in the corresponding color. Note: Do NOT hard code the log levels, colors, or resultant DOM element information in the JavaScript functions. Example Output: [debug] This is my debug message!!!! [error] Whoops we got an error! [myCustomLog] This is my custom output log message.
avatar

Senior Front-end Developer

Interviewed at Intercontinental Exchange

3.2
Jan 11, 2022

The object of this exercise is to write a custom JavaScript logger. The only markup needed will be a div with an ID attribute of “result” - where the logger will append its output. Write an object that has the following characteristics: 1. It should be a function that accepts any log level defined at runtime (e.g. debug, warn, etc.) and a corresponding color to apply to the log message (e.g. gray, orange, red, etc.) as arguments. 2. This function should return a new function that takes a message as its argument and appends it to the resultant DOM element. Use this to create loggers for debug, warn, and info levels. 3. Each appended log message should be prepended by the name of its associated level and displayed in the corresponding color. Note: Do NOT hard code the log levels, colors, or resultant DOM element information in the JavaScript functions. Example Output: [debug] This is my debug message!!!! [error] Whoops we got an error! [myCustomLog] This is my custom output log message.

Viewing 901 - 910 interview questions

Glassdoor has 1,429 interview questions and reports from Senior front end developer interviews. Prepare for your interview. Get hired. Love your job.