30 Seconds of Interviews

A curated collection of common interview questions to help you prepare for ...

README

30 Seconds of Interviews


A curated collection of common interview questions to help you prepare for your next interview.

_This README is built using markdown-builder._


Foreword


Interviews are daunting and can make even the most seasoned expert forget things under pressure. Review and learn what questions are commonly encountered in interviews curated by the community that's answered them and go prepared for anything they'll ask. By bringing together experience and real-world examples, you can go from being nervous to being prepared for that next big opportunity.


Contributing


30 seconds of interviews is a community effort, so feel free to contribute in any way you can. Every contribution helps!


Do you have an excellent idea or know some cool questions that aren't on the list? Read the contribution guidelines and submit a pull request.

Join our Gitter channel to help with the development of the project.

Related projects



Table of Contents


JavaScript


View contents

Create a function batches that returns the maximum number of whole batches that can be cooked from a recipe.

View answer

Triple equals (===) checks for strict equality, which means both the type and value must be the same. Double equals (==) on the other hand first performs type coercion so that both operands are of the same type and then applies strict comparison.


Good to hear



Whenever possible, use triple equals to test equality because loose equality == can have unintuitive results.
Type coercion means the values are converted into the same type.
Mention of falsy values and their comparison.


Additional Links


MDN docs for comparison operators

What is the difference between an element and a component in React?


An element is a plain JavaScript object that represents a DOM node or component. Elements are pure and never mutated, and are cheap to create.

A component is a function or class. Components can have state and take props as input and return an element tree as output (although they can represent generic containers or wrappers and don't necessarily have to emit DOM). Components can initiate side effects in lifecycle methods (e.g. AJAX requests, DOM mutations, interfacing with 3rd party libraries) and may be expensive to create.

  1. ```js
  2. const Component = () => "Hello"
  3. const componentElement = <Component />
  4. const domNodeElement = <div />
  5. ```

Good to hear


Elements are immutable, plain objects that describe the DOM nodes or components you want to render.
Components can be either classes or functions, that take props as an input and return an element tree as the output.

Additional Links


A stateful component is a component whose behavior depends on its state. This means that two separate instances of the component if given the same props will not necessarily render the same output, unlike pure function components.

  1. ```js
  2. // Stateful class component
  3. class App extends Component {
  4.   constructor(props) {
  5.     super(props)
  6.     this.state = { count: 0 }
  7.   }
  8.   render() {
  9.     // ...
  10.   }
  11. }

  12. // Stateful function component
  13. function App() {
  14.   const [count, setCount] = useState(0)
  15.   return // ...
  16. }
  17. ```


Good to hear



Stateful components have internal state that they depend on.
Stateful components are class components or function components that use stateful Hooks.
Stateful components have their state initialized in the constructor or with useState().

Additional Links