js 311 — Blog 6

Kasey
1 min readJul 21, 2021

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?

HTTP 409 — Conflict

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 think it is to use srcset, which will allow the browser to select the appropriate image from CSS.

When should you npm and when should you yarn?

npm and yarn serve basically the same function, however, npm performs each task sequentially, one after the other and yarn will load them all at once to speed up the process.

How can you make sure your dependencies are safe?

NPM audit, NPM Outdated

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

CHAR, is a defined character length, which always takes the same amount of storage space; VARCHAR is not a defined length, or variable length which storage space requirements will vary based on the data.

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

console.log(“first”);
setTimeout(function() {
console.log(“second”);
}, 0);
console.log(“third”);

// Output:
// first
// third
// second

change setTimeout() to setImmediate

--

--