If a user attempts to create a resource that already exists — for example, an email address that’s already registered — what HTTP status code would you return?

The HTTP 409 Conflict response status code indicates a request conflict with current state of the target resource.

Consider a responsive site design that requires a full-width image in all responsive states. What would be the correct way to code this to ensure the page loads the smallest image required to fill the space?

I usually adjust the media query section in CSS to allow for different break points. It’s difficult because there are many different screen sizes. I generally design for an iphone, tablet, and desktop. This is the site that I reference: https://css-tricks.com/snippets/css/media-queries-for-standard-devices/

When should you npm and when should you yarn?

Yarn installs packages in parallel. Yarn is optimized to fetch and install multiple packages simultaneously. If you are installing five packages, and two are taking a long time to install, Yarn will go over and install the packages side by side. On the other hand, NPM would install each package one at a time.

How can you make sure your dependencies are safe?

  1. Avoid publishing secrets to the npm registry.

2. Enforce the lockfile.

3.Minimize attack surfaces by ignoring run-scripts

4. Monitor for vulnerabilities discovered in open source libraries

What are the differences between CHAR and VARCHAR data types (MySQL)?

CHAR Datatype:
It is a datatype in SQL which is used to store character string of fixed length specified. If the length of string is less than set or fixed length then it is padded with extra blank spaces so that its length became equal to the set length. Storage size of CHAR datatype is of n bytes(set length). We should use this datatype when we expect the data values in a column are of same length.

VARCHAR Datatype:
It is a datatype in SQL which is used to store character string of variable length but maximum of set length specified. If the length of string is less than set or fixed length then it will store as it is without padded with extra blank spaces. Storage size of VARCHAR datatype is equal to the actual length of the entered string in bytes. We should use this datatype when we expect the data values in a column are of variable length.

How else can the JavaScript code below be written using Node.Js to produce the same output?