Meituan interview questions & answers

20 real Meituan interview questions with full model answers — Technical, Coding, Product & growth, Behavioral. Drawn from the same verified bank ChannelPulse drills from (32 Meituan questions in total).

BehavioralEasyMeituanFrontend EngineerSecond interview round

1. What methods do you usually use to learn?

Model answer

  1. Situation — In my previous work, I often had to learn unfamiliar frontend tools while still delivering features on schedule. One example was joining a project where I needed to understand an existing component framework and its conventions before contributing to a user-facing flow. I could not rely on a long onboarding period because the team was actively shipping.
  2. Task — I needed to become productive quickly without learning only enough to make one change. My goal was to understand the underlying model, apply it safely, and retain the knowledge so I could help the team later.
  3. Action
  • I start by clarifying the learning goal and time horizon. For a new library, I identify the two or three capabilities the current feature actually needs rather than trying to read everything.
  • I build a small working example from the official documentation, then compare it with the patterns already used in the codebase. This helps me distinguish framework behavior from local conventions.
  • I learn by applying the concept to a real, low-risk task. For example, when learning a component pattern, I trace its props, events, and state through one existing feature before implementing a small reusable piece.
  • I verify understanding by writing down the key rules and edge cases in a short note, then explain them to a teammate. Questions from the discussion often reveal gaps in my mental model.
  • I use feedback deliberately: code review, tests, and runtime behavior tell me whether I understood the concept, not just whether I copied a working snippet.
  • I revisit the notes when the same topic comes up, updating them with what I learned rather than keeping a collection of untested links.
  1. Result — This approach helps me turn unfamiliar concepts into working knowledge quickly, while keeping the risk of introducing a brittle pattern low. It also makes my learning useful to the team through clearer implementation notes and knowledge sharing. I have learned that the most effective cycle for me is focused reading, hands-on practice, feedback, and then teaching the idea back in my own words.
BehavioralMediumMeituanFrontend EngineerSecond interview round

2. What challenges did you encounter when encapsulating components?

Model answer

  1. Situation — During my internship, I helped encapsulate components for a live-streaming page that combined a player, chat, and merchant product cards. The challenge was that these pieces were reused in different page contexts, but the first version of some components knew too much about the page—for example, they fetched business data internally and made assumptions about layout and playback state.
  2. Task — I needed to make the components reusable without turning them into generic abstractions that were difficult to configure. The key tension was choosing clear ownership: which state belonged to the page, which behavior belonged inside a component, and how to expose changes without coupling consumers to implementation details.
  3. Action
  • I reviewed the call sites and identified the actual variation points before changing the API. For a product card, these were the item data, loading or disabled state, and user actions—not the page’s request logic.
  • I moved data fetching and cross-component coordination to the page layer. The card received explicit props and emitted a focused event such as onProductClick, so it could be tested independently and reused with different data sources.
  • I replaced ambiguous boolean combinations with explicit state where appropriate, and documented defaults and required inputs. This made empty and unavailable states part of the component contract rather than accidental rendering behavior.
  • I kept the API small. I resisted adding options for hypothetical future uses and instead checked existing consumers with the team before expanding the interface.
  • I added tests for the states consumers actually depended on, including missing product data, disabled actions, and repeated user interaction. I also checked that cleanup and subscriptions stayed with the component that created them.
  1. Result — The components became easier to reuse and reason about, and changes to page-level data flow no longer required edits inside presentation components. I learned that encapsulation is not simply hiding code: it is defining a stable contract and placing state with the owner that can enforce its invariants. When I design a component now, I start from its consumers and real variation points rather than trying to predict every possible future use.
BehavioralMediumMeituanFrontend EngineerSecond interview round

3. How did you implement the live-streaming feature during your internship?

Model answer

  1. Situation — During my internship, I worked on a live-streaming experience for a local-commerce page where users watched a merchant stream, chatted, and opened product or coupon cards without leaving the room. The page had several independently changing parts, and a dropped connection or slow API could make the entire experience feel broken.
  2. Task — I owned the frontend integration for the viewing experience. The constraint was to deliver a responsive, reliable page using the company’s existing playback infrastructure rather than building a media protocol or tightly coupling the player to business UI.
  3. Action
  • I mapped the user flow and separated responsibilities: the page coordinated room data, a player wrapper handled the playback SDK, and independent components handled chat and product cards. I aligned the component interfaces with my mentor before implementation.
  • On entry, the page fetched room metadata and stream information, then initialized the player only after the required data was available. I represented playback explicitly with states such as loading, playing, paused, ended, and error so the UI did not infer state from scattered booleans.
  • I integrated the existing player SDK and subscribed to its events. I connected chat through the team’s real-time channel and fetched product-card data through the normal API, keeping these failure domains separate from video playback.
  • I handled reconnect and teardown deliberately: retry UI was shown on playback failure, event listeners and timers were removed on unmount, and late responses were prevented from updating a page the user had already left.
  • I tested slow responses, stream errors, repeated entry and exit, and empty product data. I used code review to confirm the retry behavior and to avoid duplicating connection logic already provided by shared infrastructure.
  1. Result — The feature worked across the main viewing flow and its important failure states, and the separation made later UI changes safer because business cards did not depend on player internals. I learned that live experiences require careful lifecycle and state management: users notice not only whether playback starts, but also whether the page recovers clearly when a dependency fails.
BehavioralMediumMeituanFrontend EngineerSecond interview round

4. What did you learn during your internship?

Model answer

  1. Situation — During my internship, I worked on the frontend for a local-commerce live-streaming page. The feature brought together video playback, a real-time chat, and merchant product cards, so changes in one area could easily affect the others. I was new to the codebase and initially focused too much on making the page look correct in the happy path.
  2. Task — I wanted to deliver my assigned features reliably while learning how a production frontend team makes changes safely, especially when user experience depends on network conditions and shared components.
  3. Action
  • I first learned the existing architecture instead of immediately replacing pieces: I traced the page from its route and data requests through the player wrapper and shared UI components.
  • I broke work into small, reviewable changes. For example, I separated the product-card rendering from the playback controls so each could be tested and reviewed independently.
  • I learned to treat loading, empty, error, and reconnecting states as part of the feature—not as polish to add later. I reproduced slow and interrupted connections and added clear fallback states rather than leaving users with a blank area.
  • I asked for early code review and brought specific questions, such as whether a state belonged in the page or in a reusable component. I used the answers to understand the team’s conventions, then documented the decisions in the change description.
  • I added checks around lifecycle cleanup and repeated navigation, because a page that works once can still leak listeners or duplicate requests when users revisit it.
  1. Result — I became faster at delivering changes without creating avoidable regressions, and my work was easier for teammates to review because the responsibilities and edge cases were explicit. The main lesson I took away was that frontend quality is not just visual accuracy: it is predictable state, clear ownership, and resilience to real user and network behavior. I now try to understand the system and its failure modes before optimizing the implementation.
CodingMediumMeituanFrontend EngineerFirst interview round

5. How would you implement cancellation of requests when wrapping requests with Promises?

Model answer

A Promise itself is not cancelable. For fetch, I’d use AbortController and expose a cancel() method alongside the promise. The controller stops the underlying request; rejecting the wrapper alone would only stop the caller from waiting.

function request(url, options = {}) {
  const controller = new AbortController();
  let settled = false;

  const promise = fetch(url, {
    ...options,
    signal: controller.signal
  }).then((response) => {
    if (!response.ok) {
      throw new Error(`HTTP ${response.status}`);
    }
    return response.json();
  }).finally(() => {
    settled = true;
  });

  return {
    promise,
    cancel(reason = 'Request cancelled') {
      // Abort only while work is still in progress.
      if (!settled) {
        controller.abort(new Error(reason));
      }
    }
  };
}

// Example: cancel a request when the user changes the search query.
const search = request('/api/search?q=noodles');
search.promise
  .then((results) => console.log(results))
  .catch((error) => {
    if (error.name === 'AbortError' || error.message === 'Request cancelled') {
      return; // Expected cancellation; don't show it as a user-facing failure.
    }
    console.error('Search failed:', error);
  });

search.cancel();
  • Pass the AbortSignal to the API that performs the work; merely rejecting a wrapper promise does not cancel I/O.
  • In UI code, cancel the previous request when a newer query supersedes it, and treat cancellation separately from failures.
  • For APIs without native cancellation, the wrapper can ignore stale results, but the underlying operation may still consume resources.

Complexity: O(1) wrapper overhead; request time and network resource use depend on the underlying operation.

CodingMediumMeituanFrontend EngineerFirst interview round

6. Write an implementation that finds the indices of duplicate numbers in an array.

Model answer

function duplicateIndices(numbers) {
  const counts = new Map();

  // Count each number, including negative values and zero.
  for (const number of numbers) {
    counts.set(number, (counts.get(number) || 0) + 1);
  }

  const indices = [];
  for (let i = 0; i < numbers.length; i++) {
    // Return every index whose number occurs more than once.
    if (counts.get(numbers[i]) > 1) indices.push(i);
  }

  return indices;
}

// Example: [1, 2, 1, 3, 2] -> [0, 1, 2, 4]
console.log(duplicateIndices([1, 2, 1, 3, 2]));
  • The first pass counts occurrences; the second collects the indices of all values that occur more than once.
  • This returns every occurrence in a duplicate group, including its first occurrence.

Complexity: O(n) time and O(u) space, where u is the number of unique values.

CodingHardMeituanFrontend EngineerFirst interview round

7. Write an implementation of the Promise/A+ specification.

Model answer

// A small Promise/A+-style implementation.
const schedule = (fn) => setTimeout(fn, 0);

function resolvePromise(promise, value, fulfill, reject) {
  // A promise cannot resolve to itself.
  if (promise === value) {
    reject(new TypeError('A promise cannot resolve to itself'));
    return;
  }

  if (value !== null && (typeof value === 'object' || typeof value === 'function')) {
    let then;
    try {
      // Read once: a thenable may expose a throwing getter.
      then = value.then;
    } catch (error) {
      reject(error);
      return;
    }

    if (typeof then === 'function') {
      let called = false;
      try {
        then.call(
          value,
          (nextValue) => {
            if (called) return;
            called = true;
            resolvePromise(promise, nextValue, fulfill, reject);
          },
          (reason) => {
            if (called) return;
            called = true;
            reject(reason);
          }
        );
      } catch (error) {
        if (!called) {
          called = true;
          reject(error);
        }
      }
      return;
    }
  }

  fulfill(value);
}

class MyPromise {
  constructor(executor) {
    this.state = 'pending';
    this.value = undefined;
    this.handlers = [];

    const fulfill = (value) => {
      if (this.state !== 'pending') return;
      this.state = 'fulfilled';
      this.value = value;
      this.flush();
    };

    const rejectInternal = (reason) => {
      if (this.state !== 'pending') return;
      this.state = 'rejected';
      this.value = reason;
      this.flush();
    };

    // The executor's resolve/reject pair may only take effect once,
    // including when resolve starts adopting a pending thenable.
    let alreadyResolved = false;
    const resolve = (value) => {
      if (alreadyResolved) return;
      alreadyResolved = true;
      resolvePromise(this, value, fulfill, rejectInternal);
    };
    const reject = (reason) => {
      if (alreadyResolved) return;
      alreadyResolved = true;
      rejectInternal(reason);
    };

    try {
      executor(resolve, reject);
    } catch (error) {
      reject(error);
    }
  }

  flush() {
    const handlers = this.handlers;
    this.handlers = [];
    handlers.forEach((handler) => this.runHandler(handler));
  }

  runHandler(handler) {
    schedule(() => {
      const fulfilled = this.state === 'fulfilled';
      const callback = fulfilled ? handler.onFulfilled : handler.onRejected;

      // Missing handlers pass fulfillment through or propagate rejection.
      if (typeof callback !== 'function') {
        (fulfilled ? handler.resolve : handler.reject)(this.value);
        return;
      }

      try {
        handler.resolve(callback(this.value));
      } catch (error) {
        handler.reject(error);
      }
    });
  }

  then(onFulfilled, onRejected) {
    return new MyPromise((resolve, reject) => {
      const handler = { onFulfilled, onRejected, resolve, reject };
      if (this.state === 'pending') {
        this.handlers.push(handler);
      } else {
        this.runHandler(handler);
      }
    });
  }

  catch(onRejected) {
    return this.then(undefined, onRejected);
  }

  static resolve(value) {
    if (value instanceof MyPromise) return value;
    return new MyPromise((resolve) => resolve(value));
  }

  static reject(reason) {
    return new MyPromise((_, reject) => reject(reason));
  }
}

// Example:
MyPromise.resolve(2)
  .then((value) => value + 3)
  .then((value) => console.log(value)); // 5
  • Resolution adopts promises and foreign thenables, reads then once, and guards against multiple callback calls.
  • Each then returns a new promise; callbacks run asynchronously, and thrown errors become rejections.
  • Complexity: O(k) work to dispatch k queued handlers, plus thenable-adoption depth; O(k) space for pending handlers.
CodingHardMeituanFrontend EngineerFirst interview round

8. Implement a Promise from scratch.

Model answer

// A small Promise/A+-style implementation using the native event loop,
// but not the native Promise implementation.
const enqueue = typeof queueMicrotask === "function"
  ? queueMicrotask
  : (fn) => setTimeout(fn, 0);

function resolveValue(promise, value) {
  if (promise === value) {
    promise._settle("rejected", new TypeError("Promise cannot resolve itself"));
    return;
  }

  if (value !== null && (typeof value === "object" || typeof value === "function")) {
    let then;
    try {
      then = value.then; // Accessing a thenable's getter can throw.
    } catch (error) {
      promise._settle("rejected", error);
      return;
    }

    if (typeof then === "function") {
      let called = false;
      try {
        then.call(
          value,
          (nextValue) => {
            if (called) return;
            called = true;
            resolveValue(promise, nextValue); // Adopt nested thenables.
          },
          (reason) => {
            if (called) return;
            called = true;
            promise._settle("rejected", reason);
          }
        );
      } catch (error) {
        if (!called) {
          called = true;
          promise._settle("rejected", error);
        }
      }
      return;
    }
  }

  promise._settle("fulfilled", value);
}

class MyPromise {
  constructor(executor) {
    this._state = "pending";
    this._value = undefined;
    this._handlers = [];

    let alreadyResolved = false;
    const resolve = (value) => {
      if (alreadyResolved) return;
      alreadyResolved = true;
      resolveValue(this, value);
    };
    const reject = (reason) => {
      if (alreadyResolved) return;
      alreadyResolved = true;
      this._settle("rejected", reason);
    };

    try {
      executor(resolve, reject);
    } catch (error) {
      reject(error);
    }
  }

  _settle(state, value) {
    if (this._state !== "pending") return;
    this._state = state;
    this._value = value;
    this._handlers.forEach((handler) => this._run(handler));
    this._handlers = [];
  }

  _run(handler) {
    enqueue(() => {
      const callback = this._state === "fulfilled"
        ? handler.onFulfilled
        : handler.onRejected;

      if (typeof callback !== "function") {
        (this._state === "fulfilled" ? handler.resolve : handler.reject)(this._value);
        return;
      }

      try {
        handler.resolve(callback(this._value)); // The child adopts the result.
      } catch (error) {
        handler.reject(error);
      }
    });
  }

  then(onFulfilled, onRejected) {
    return new MyPromise((resolve, reject) => {
      const handler = { onFulfilled, onRejected, resolve, reject };
      this._handlers.push(handler);
      if (this._state !== "pending") this._run(handler);
    });
  }

  catch(onRejected) {
    return this.then(undefined, onRejected);
  }

  static resolve(value) {
    return value instanceof MyPromise ? value : new MyPromise((resolve) => resolve(value));
  }

  static reject(reason) {
    return new MyPromise((resolve, reject) => reject(reason));
  }

  static all(iterable) {
    return new MyPromise((resolve, reject) => {
      const items = Array.from(iterable);
      const results = new Array(items.length);
      if (items.length === 0) return resolve(results);

      let remaining = items.length;
      items.forEach((item, index) => {
        MyPromise.resolve(item).then((value) => {
          results[index] = value;
          if (--remaining === 0) resolve(results);
        }, reject);
      });
    });
  }

  static race(iterable) {
    return new MyPromise((resolve, reject) => {
      for (const item of iterable) MyPromise.resolve(item).then(resolve, reject);
    });
  }
}
  • The constructor runs the executor synchronously and locks in its first resolve/reject call.
  • then callbacks run asynchronously; chained promises adopt returned values and thenables.
  • The implementation includes catch, resolve, reject, all, and race; it omits some production details such as finally and cross-realm promise detection.

Complexity: Settling a promise with k registered handlers takes O(k) time; handler storage is O(k).

Product & growthMediumMeituanFrontend EngineerSecond interview round

9. How do you evaluate the results after optimizing a page?

Model answer

Clarify & scope

I’d first confirm what “optimized” means for this page: faster loading, better task completion, or both. I’d compare the new version with a representative baseline, keeping the page’s content, traffic mix, and measurement window comparable. For a Meituan page, such as a restaurant listing, I’d care about both the customer experience and downstream actions like opening a restaurant or placing an order.

User segments & pain points

I’d segment by device, network quality, app or browser entry point, city, and new versus returning users. Averages can hide a regression—for example, a page may improve on Wi-Fi but get slower on lower-end Android devices or weak mobile networks.

Goals & success metrics

My North Star would be the page’s intended user outcome, such as successful restaurant-detail visits or orders per eligible session. I’d pair that with frontend measures: real-user p75 LCP, INP, and CLS; error rate; and abandonment. I’d also watch guardrails such as API failures, image quality, and conversion, so a faster page that harms usability is not called a success.

Solutions

I’d measure before and after using both field data and controlled lab tests. Field data tells me what customers actually experience; lab tests help reproduce and diagnose regressions. For a release behind an experiment, I’d compare treatment and control with consistent eligibility and attribution, and check that the change—not a traffic or campaign shift—explains the result.

flowchart LR
  A[Set baseline] --> B[Ship to experiment]
  B --> C[Measure user outcomes]
  B --> D[Measure performance]
  C --> E[Check segments and guardrails]
  D --> E
  E --> F{Improved safely?}
  F -->|Yes| G[Expand rollout]
  F -->|No| H[Investigate or roll back]
Diagram

Prioritization & trade-offs

I’d prioritize changes that improve a user-visible bottleneck and have a measurable impact. For example, reducing above-the-fold image weight is usually preferable to optimizing a rarely used interaction. I’d make the trade-off explicit if an optimization saves time but increases maintenance complexity or reduces visual quality.

MVP, measurement & rollout

I’d define the hypothesis, primary metric, guardrails, sample size, and decision window before launch. I’d release to a small percentage, inspect both aggregate and segment results, then expand gradually if the improvement is statistically credible and guardrails remain healthy. I’d also verify the result after full rollout and document the baseline, change, and observed impact.

Product & growthMediumMeituanFrontend EngineerFirst interview round

10. What strategies would you use to optimize a page's first-screen rendering, and which metrics would you measure?

Model answer

Clarify & scope

I would define first-screen rendering as the time until the key above-the-fold content is visible and usable, especially on mobile networks. I would first identify the page’s primary action—such as searching for a restaurant or opening a deal—so optimization preserves that experience rather than just improving a lab score.

User segments & pain points

I would focus first on mobile users on slower devices or unstable networks. They are most affected by large JavaScript bundles, slow API responses, and oversized hero images. I would compare these users with desktop and repeat visitors to find where the gap is largest.

Goals & success metrics

My North Star would be the share of eligible visits where the first screen is usable quickly and the user can start the primary action. I would track real-user, p75 metrics by device, network, and page type:

  • LCP for when the main content appears; target at or below 2.5 seconds.
  • INP for interaction responsiveness; target at or below 200 ms. I would not use FID as the current responsiveness metric.
  • CLS for layout stability; target at or below 0.1.
  • TTFB and FCP to separate server delay from rendering delay, plus JavaScript errors and primary-action conversion as guardrails.

Solutions

I would investigate the critical path, then prioritize changes with measurable impact:

  1. Improve delivery: use CDN caching, compression, and appropriately cached HTML or server rendering for content that must appear immediately.
  2. Reduce render-blocking work: inline only critical CSS, defer non-critical scripts, split bundles, remove unused code, and avoid expensive synchronous hydration.
  3. Prioritize above-the-fold assets: resize and compress the LCP image, use modern formats, and preload it only when it is genuinely the LCP resource. Lazy-load below-the-fold images and defer nonessential widgets.
  4. Reduce data wait: return the minimum data needed for the first screen and cache stable responses. Use a skeleton only when it accurately reflects the layout; it should not hide a slow page.

Recommendation: start with the largest real-user bottleneck—often the LCP asset, API latency, or JavaScript execution—rather than applying every optimization at once.

Prioritization & trade-offs

I would rank work by user impact, affected traffic, confidence, and implementation cost. For example, delaying a low-value recommendation widget may improve first interaction, but I would verify that it does not materially reduce discovery or conversion.

MVP, measurement & rollout

I would establish a segmented baseline, ship the highest-impact change behind an experiment, and compare p75 Web Vitals and primary-action conversion against a control. I would roll out gradually, monitor errors and business guardrails, and retain the change only if the improvement holds across key device and network segments.

TechnicalEasyMeituanFrontend EngineerFirst interview round

11. What are the advantages of Promises, and what problems do they solve?

Model answer

Promises represent the eventual result of an asynchronous operation: either a value or an error. They solve several problems common with callbacks:

  1. Flattening nested async code: Returning a promise from .then() chains the next operation, rather than nesting callbacks inside callbacks.
  2. Consistent error propagation: A rejection travels down the chain until a .catch() handles it. This makes errors from multiple async steps easier to manage in one place.
  3. Composition: Promise.all, Promise.allSettled, Promise.race, and Promise.any express common coordination patterns clearly. For example, Promise.all is useful when independent data requests must all finish before rendering a page.
  4. Interoperability: APIs that return promises have a consistent interface and can be consumed with either .then() or async/await.

A promise has three states: pending, fulfilled, or rejected. Once settled, its state and result do not change. That makes completion easier to reason about than callbacks that may be invoked inconsistently.

flowchart LR
  A[Pending] -->|resolve value| B[Fulfilled]
  A -->|reject error| C[Rejected]
  B --> D[then handler]
  C --> E[catch handler]
Diagram

Promises do not automatically provide cancellation, retries, or concurrency limits. For example, Promise.race can stop waiting for a slow request, but does not stop the underlying network operation. Those concerns need explicit mechanisms such as AbortController for fetch cancellation or a queue for limiting concurrency.

TechnicalEasyMeituanFrontend EngineerFirst interview round

12. What is the difference between CSS opacity and transparency set with rgba()?

Model answer

opacity applies to an entire element and its rendered contents. rgba() sets the alpha channel of one color value, such as a background color.

.card--faded {
  opacity: 0.5;
}

.card--tinted {
  background-color: rgba(0, 0, 0, 0.5);
}

With opacity: 0.5, the element, its text, images, and descendants are all rendered at half opacity. An element with opacity below 1 also creates a stacking context, which can affect z-index behavior.

With rgba(..., 0.5), only that particular color is translucent. The text and child elements remain fully opaque unless their own styles make them transparent. This is usually the right choice for a translucent overlay or background behind readable content.

Use opacity when the whole component should fade, such as a disabled control or transition. Use an alpha color when only a background, border, or shadow should be transparent. Neither property makes the element stop receiving pointer events; use pointer-events or remove/disable the element if that behavior is needed.

TechnicalMediumMeituanFrontend EngineerFirst interview round

13. What are the solutions for handling cookies in cross-origin requests?

Model answer

For a cross-origin request that needs cookies, I check both sides of the exchange: the browser request must include credentials, and the server must explicitly permit credentialed CORS.

  1. Include credentials on the client. With fetch, set credentials: 'include'; with XMLHttpRequest, set withCredentials = true.
  2. Configure the server’s CORS response. Return the specific requesting origin in Access-Control-Allow-Origin—not *—and Access-Control-Allow-Credentials: true. If the origin is selected dynamically, vary the response on Origin and allow that origin only after validation.
  3. Set cookie attributes for the deployment. A cookie intended for cross-site use generally needs SameSite=None; Secure, and the request must use HTTPS. Domain and Path should be no broader than required. A same-site subdomain setup may be possible without making the cookie available to unrelated sites.
  4. Handle preflight where needed. Requests with non-simple methods or headers can trigger OPTIONS; the server must allow the origin, method, and requested headers there too.
  5. Account for browser privacy protections. SameSite=None does not override browser blocking or partitioning of third-party cookies. When third-party cookies are unavailable, prefer a same-site architecture, a backend-for-frontend, or another supported authentication flow rather than relying on them.
sequenceDiagram
  participant B as Browser
  participant F as Frontend origin
  participant A as API origin
  B->>A: OPTIONS preflight if required
  A-->>B: Allow origin, credentials, method, headers
  F->>A: Request with credentials included
  B->>A: Attach eligible cookie
  A-->>B: Response with exact allowed origin and credentials
  B-->>F: Expose response to frontend
Diagram

The cookie is attached by the browser only when its domain, path, security, and SameSite rules permit it. JavaScript cannot read the Set-Cookie response header, and an HttpOnly cookie cannot be read through document.cookie; those are intentional protections. For a Meituan page calling an API on a different origin, I’d verify the actual request and response headers in browser dev tools and test in the browsers we support, rather than assuming a successful server response means the browser exposed it to JavaScript.

TechnicalMediumMeituanFrontend EngineerFirst interview round

14. How would you choose a framework for a new project?

Model answer

I would choose a framework based on the product’s constraints and the team’s ability to deliver and maintain it—not on popularity alone.

  1. Clarify requirements. Identify the users, product lifetime, page types, interaction complexity, rendering needs, performance targets, accessibility requirements, and expected team size. A Meituan merchant console with many data-heavy workflows has different needs from a lightweight campaign landing page.
  2. Check constraints first. Confirm compatibility with the company’s design system, routing, state-management, build, testing, analytics, localization, and deployment infrastructure. Consider browser/device support and whether SEO or server-side rendering matters.
  3. Compare viable options. Evaluate ecosystem maturity, hiring and learning curve, component model, performance, bundle size, accessibility, upgrade stability, debugging tools, and long-term maintenance. Build a small proof of concept for the riskiest requirement—such as a complex form, map, or server-rendered page—rather than relying only on benchmarks.
  4. Choose the simplest option that meets requirements. Prefer an established framework already supported by the organization when its capabilities fit. A new framework should have a clear benefit that outweighs migration, training, and operational costs.
  5. Validate with a small implementation. Test a representative user journey, measure bundle and runtime performance, and gather feedback from the engineers who will own it. Record the decision and revisit it if requirements materially change.
flowchart TD
    A[Clarify product and technical needs] --> B{Existing platform fits?}
    B -->|Yes| C[Prefer supported framework]
    B -->|No| D[Shortlist alternatives]
    D --> E[Prototype highest-risk use case]
    E --> F[Compare delivery and maintenance cost]
    C --> G[Validate with representative journey]
    F --> G
    G --> H[Decide and document trade-offs]
Diagram

I would make the decision against explicit criteria and real constraints, not treat any framework as universally best. The key outcome is a framework the team can use safely and consistently for the expected life of the product.

TechnicalMediumMeituanFrontend EngineerFirst interview round

15. How do you unit test your own projects?

Model answer

I test the smallest unit that gives useful confidence, while keeping tests deterministic and focused on observable behavior.

  1. Identify the unit and its contract. For a pure function, test inputs and outputs. For a component, test what a user sees and does rather than its private implementation details. For example, a cart component should display the updated total after a quantity change.
  2. Use the test pyramid. Keep most tests fast unit tests for business logic and utilities. Add component tests for interactions and a smaller number of integration or end-to-end tests for critical journeys, such as search-to-checkout.
  3. Cover meaningful cases. Include the normal path, boundaries, invalid inputs, empty states, and failure behavior. For asynchronous code, test loading, success, and error states. Avoid tests that merely duplicate implementation or assert incidental markup.
  4. Isolate external dependencies. Mock network calls, clocks, randomness, and browser APIs at clear boundaries. Prefer dependency injection or a small API-client abstraction; avoid excessive mocking of internal functions because it can make tests brittle.
  5. Keep the suite trustworthy. Use fixtures that resemble real data, reset state between tests, and avoid order dependence. Run tests locally and in CI, and investigate flaky failures instead of retrying them indefinitely.
  6. Use coverage as a signal, not the goal. I look at whether risky business rules and failure paths are covered, not whether every line is exercised. I also review production bugs and add regression tests for their root causes.
flowchart LR
    A[Pure logic] --> B[Unit tests]
    C[Component behavior] --> D[Component tests]
    E[Critical user journey] --> F[Integration or E2E tests]
    B --> G[Fast feedback in CI]
    D --> G
    F --> H[Confidence in end-to-end behavior]
Diagram

For a delivery or ordering frontend, I would test price calculations and eligibility rules as isolated units, test cart interactions at component level, and reserve end-to-end tests for a few high-value customer journeys. This balances speed, confidence, and maintenance cost.

TechnicalMediumMeituanFrontend EngineerSecond interview round

16. How do TypeScript decorators work?

Model answer

  1. What a decorator does: A TypeScript decorator is a function applied to a class or class member. It can inspect or augment the declaration, or—in supported cases—replace its implementation. It runs as part of class definition/module evaluation, not each time an instance is created.
  2. Modern versus legacy decorators: TypeScript 5 supports the newer ECMAScript decorator model by default. A method decorator receives the original method and a context object; it can return a replacement method. The older TypeScript model is enabled with experimentalDecorators and uses different arguments, such as target, propertyKey, and a property descriptor. The two models are not interchangeable.
  3. Modern method example:
function logged<This, Args extends unknown[], Return>(
  original: (this: This, ...args: Args) => Return,
  context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return>
) {
  const methodName = String(context.name);

  return function (this: This, ...args: Args): Return {
    console.log(`Calling ${methodName}`);
    return original.apply(this, args);
  };
}

class RestaurantService {
  @logged
  findNearby(cityId: string) {
    return `restaurants in ${cityId}`;
  }
}
  1. Important details: Decorators are applied when the class is defined, and stacked decorators are applied from the declaration outward (bottom to top). Modern decorators support classes and several member kinds, including methods, fields, accessors, and getters/setters. They do not support parameter decorators, unlike common legacy decorator use. Modern decorators also do not automatically emit the legacy design:type metadata; libraries relying on emitDecoratorMetadata and reflect-metadata generally require the legacy model.
  2. When I’d use them: I’d use decorators for consistent cross-cutting behavior—such as method-level instrumentation—when the team’s build setup and framework support the chosen model. I’d avoid them when a normal function wrapper is clearer, or when the behavior is hidden enough to make debugging and testing harder.
TechnicalMediumMeituanFrontend EngineerFirst interview round

17. How would you transition to developing with TypeScript?

Model answer

I would migrate incrementally, using TypeScript to reduce risk rather than creating a large conversion project.

  1. Set the target and baseline. Agree on the TypeScript version, strict settings, lint rules, build integration, and success measures such as type-check coverage and production defects. Check that the current framework, test runner, and build tools support the intended setup.
  2. Enable TypeScript without blocking delivery. Add tsconfig.json and type-checking to CI. In a JavaScript project, allow JS files initially with allowJs; migrate file by file instead of requiring an all-at-once rewrite.
  3. Start at stable boundaries. Convert shared utilities, API clients, and data models first. Define types for API responses and request parameters, and validate untrusted network data at runtime where needed—TypeScript types alone do not validate JSON.
  4. Migrate high-value components next. Prioritize code with frequent changes, complex props, or costly runtime bugs. Use explicit prop, event, and state types; avoid any where possible, but use a narrow temporary escape hatch rather than spending days modeling unstable legacy behavior.
  5. Keep feedback fast. Run type-checking, linting, and tests in CI; use editor errors during development. Track remaining JavaScript and unsafe casts, and tighten compiler options as the code improves.
  6. Update team practices. Provide examples for common patterns, review types as part of API design, and teach the team to distinguish compile-time guarantees from runtime validation.
flowchart LR
    A[Baseline tools and rules] --> B[Enable mixed JS and TS]
    B --> C[Type shared utilities and API boundaries]
    C --> D[Migrate high-risk features]
    D --> E[Tighten strict checks]
    E --> F[Track coverage and maintain]
Diagram

For example, in an ordering frontend, I would type the cart and pricing API contracts early, then migrate the checkout components that consume them. That creates useful guarantees at a high-impact boundary without requiring an immediate rewrite of every page.

TechnicalMediumMeituanFrontend EngineerSecond interview round

18. What is the purpose of the uni-app framework, and how is it implemented?

Model answer

uni-app is a cross-platform application framework in the DCloud ecosystem. It lets a team build application pages primarily with Vue, then target platforms such as WeChat Mini Programs, H5, and native apps from a shared codebase. The purpose is to reuse product logic and much of the UI while adapting the platform-specific parts where necessary.

  1. Write in the framework model. Developers use Vue components, pages, styles, and lifecycle hooks, plus uni-app APIs such as uni.request, uni.navigateTo, and uni.getStorage.
  2. Compile for each target. The build tool processes the source and generates platform-appropriate output. This is not simply one identical web bundle running everywhere: the compiler handles target differences, and platform-specific APIs and templates may require conditional compilation.
  3. Run with platform adapters. At runtime, uni-app APIs map to the capabilities of the target environment—for example, browser behavior on H5 and platform APIs in a mini program or native app. Native-app builds can use the uni-app runtime and native rendering/integration capabilities.
  4. Handle differences deliberately. Check API support and layout behavior per target. Use shared components for common behavior, platform-specific branches for real incompatibilities, and test on the actual target platforms.
flowchart LR
  S["Vue pages and components"] --> C["uni-app compiler"]
  C --> H["H5 output"]
  C --> M["Mini Program output"]
  C --> N["App output"]
  H --> R["Browser runtime"]
  M --> A["Mini Program APIs"]
  N --> X["Native runtime and APIs"]
Diagram

The main benefit is shared development and maintenance, not a guarantee of identical behavior or zero platform-specific work. For a Meituan-style consumer flow, the same page and business logic might be reused across H5 and a mini program, while payment, navigation, and other platform capabilities still need target-specific validation.

TechnicalMediumMeituanFrontend EngineerFirst interview round

19. What are strong caching and conditional caching, and what are their practical applications?

Model answer

In browser HTTP caching, strong caching (often called fresh caching) serves a still-fresh response directly from the browser cache, without contacting the server. It is mainly controlled by Cache-Control: max-age=... or the older Expires header. For example, a versioned JavaScript bundle can be cached for a long time:

Cache-Control: public, max-age=31536000, immutable

Conditional caching validates a cached response with the server once it becomes stale. The browser sends a validator such as If-None-Match (from ETag) or If-Modified-Since (from Last-Modified). If the resource is unchanged, the server returns 304 Not Modified and the browser reuses its cached body; otherwise it returns a new 200 response.

sequenceDiagram
    participant B as Browser
    participant S as Server
    B->>B: Check cached response freshness
    alt Fresh response
        B->>B: Use cached body
    else Stale response with validator
        B->>S: Request with If-None-Match or If-Modified-Since
        alt Resource unchanged
            S-->>B: 304 Not Modified
            B->>B: Reuse cached body
        else Resource changed
            S-->>B: 200 with new body and validators
            B->>B: Store updated response
        end
    end
Diagram

Practical choices:

  • Use long-lived strong caching for content-hashed assets, such as app.a1b2.js; changing the file changes its URL.
  • Use conditional caching for resources whose URL stays stable but whose content may change, such as profile data or an image endpoint.
  • Avoid long-lived caching for frequently changing or user-specific responses unless cache scope and invalidation are carefully controlled. private and no-store are useful for sensitive data.

The key distinction is that strong caching can avoid a network request, while conditional caching saves response-body transfer but still requires a validation request.

TechnicalMediumMeituanFrontend EngineerSecond interview round

20. What is your understanding of front-end modularization and componentization?

Model answer

Modularization organizes a codebase into units with clear responsibilities, public interfaces, and controlled dependencies. A module might own checkout, search, or user identity. Its goal is to limit coupling so teams can change and test one area without understanding the whole application. Modules can be packages in a monolith, workspace packages in a monorepo, or separately deployed micro-frontends; deployment separation is a choice, not a requirement for modularity.

Componentization breaks the UI into reusable, composable pieces, such as a store card, price display, or delivery-time selector. A good component has a clear purpose, a small and stable API, and predictable behavior. It should encapsulate presentation and local interaction state while leaving domain-level state ownership explicit.

flowchart TD
    A[Application] --> B[Search module]
    A --> C[Order module]
    B --> D[Search page]
    D --> E[Search bar component]
    D --> F[Store card component]
    C --> G[Checkout page]
Diagram

The two concepts complement each other: modules define ownership and dependency boundaries; components define UI composition boundaries. A search module might expose a search page and a small set of shared types while keeping its internal components private.

When designing boundaries, I look for cohesive functionality, stable contracts, and ownership of data and behavior. I avoid both extremes: a giant component with unrelated responsibilities and excessive fragmentation into tiny components that require many props and are hard to understand. I also watch for circular module dependencies and uncontrolled shared state. A practical approach is to start with feature-oriented modules, keep shared UI primitives in a deliberate design-system layer, and extract or split further when reuse, team ownership, build performance, or independent release needs justify the added coordination cost.

Practice these out loud, don't memorise them

Reading an answer is not the same as being able to give one under pressure. ChannelPulse plays the interviewer, asks the follow-ups, and scores each answer with feedback and a model answer so you can hear the gap between what you said and what lands.

Get ChannelPulse Browse all questions