SQL
Blogpost 303
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?
409- The user account already exists.
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?
You could use the max-width property in CSS and set it to 100% to make the image responsive and scale to whatever the page size may be.
When should you npm and when yarn?
Npm performs the necessary steps sequentially, meaning that each package must be fully installed before moving to the next. Yarn by comparison has the power to perform multiple installation steps at once, which drastically speeds up the process. However Yarn adds to your storage space as it stores dependencies locally.
How can you make sure your dependencies are safe?
Make sure to check the NPM packages before you install them and read about them on npmjs.com. Run — npm audit to check for and fix any vulnerabilities that you might have.
What are the differences between CHAR and VARCHAR data types? (MySQL)
The short answer is: VARCHAR is variable length, while CHAR is fixed length. CHAR is a fixed length string data type, so any remaining space in the field is padded with blanks. CHAR takes up 1 byte per character.
VARCHAR is a variable length string data type, so it holds only the characters you assign to it. VARCHAR takes up 1 byte per character, + 2 bytes to hold length information. For example, if you set a VARCHAR(100) data type = ‘Jen’, then it would take up 3 bytes (for J, E, and N) plus 2 bytes, or 5 bytes in all.
How else can the JavaScript code below be written using Node.Js to produce the same output?
return “first”;
setTimeout(function() {
return “second”; }, 0);
return “third”;