
Snapdeal


Snapdeal Front end Engineer Interview Questions and Answers
Q1. Write a code to find if the input date is today or tomorrow based on the current date. If it's not today or tomorrow, output the no of days difference between the input date and the current date.
Code to find if input date is today/tomorrow or no of days difference from current date.
Get current date using Date() constructor
Convert input date to Date object
Compare input date with current date to check if it's today/tomorrow
If not, calculate the difference in days using getTime() method
Output the result accordingly
Q2. Explain box model in css, and what is specificity in CSS. What are render-blocking statements?
Box model defines how elements are rendered in CSS. Specificity determines which CSS rule applies to an element. Render-blocking statements delay page rendering.
Box model includes content, padding, border, and margin.
Specificity is calculated based on the number of selectors and their types.
Render-blocking statements are CSS or JavaScript files that prevent the page from rendering until they are loaded.
Use media queries to optimize rendering and reduce render-blocking stateme...read more
Q3. What is event bubbling, event capturing and its use?
Event bubbling and event capturing are two mechanisms in JavaScript that describe the order in which events are handled.
Event bubbling is the process where an event is first captured by the innermost element and then propagated to its parent elements.
Event capturing is the opposite process where an event is first captured by the outermost element and then propagated to its child elements.
Event bubbling is the default behavior in most browsers.
Event.stopPropagation() can be us...read more
Q4. How will you implement infinite scrolling in react js?
Implement infinite scrolling in React JS using Intersection Observer API.
Use Intersection Observer API to detect when the user has scrolled to the bottom of the page.
Fetch new data and append it to the existing data using setState.
Use a loading spinner to indicate that new data is being fetched.
Add a debounce function to prevent multiple API calls while scrolling.
Use a key prop when rendering the list of data to avoid re-rendering of existing elements.
Q5. Tell about Saas( Syntactically Awesome Style Sheets)
Saas is a CSS preprocessor that extends the functionality of CSS with variables, mixins, and more.
Saas stands for Syntactically Awesome Style Sheets
It allows for the use of variables, mixins, and functions in CSS
Saas code must be compiled into CSS before it can be used in a web page
Saas is often used in conjunction with build tools like Gulp or Webpack
Q6. Write code to find if two objects are equal or not in javascript
Code to check equality of two objects in JavaScript
Use the JSON.stringify() method to convert the objects into strings
Compare the string representations of the objects using the === operator
If the strings are equal, the objects are considered equal
Q7. What is bind in javascript and write its polyfill
Bind creates a new function with a specified 'this' value and arguments.
Bind returns a new function with the same body as the original function.
The 'this' value of the new function is bound to the first argument passed to bind().
The subsequent arguments are passed as arguments to the new function.
Polyfill for bind() can be created using call() or apply() methods.
Q8. what is the difference between async and defer
async loads script while page continues to load, defer loads script after page has loaded
async loads scripts asynchronously while page continues to load
defer loads scripts after the page has loaded
async scripts may not execute in order, while defer scripts do
async scripts may cause rendering issues, while defer scripts do not



Reviews
Interviews
Salaries
Users/Month

