Order Status Helper

Summarize nested order data for a support dashboard.

Start building, submit solution and get feedback from the community.
2Submit Solution
5 upvotes10 upvotes

Order Status Helper

Summarize an order object for a support dashboard. The final summary should expose payment status, shipping status, item count, and whether the order needs attention.

Write these functions:

  • isPaid(order) should return true when payment.status is "paid".

  • hasShipped(order) should return true when shipping.status is "shipped".

  • getDeliveryMessage(order) should return a shipping message and include estimatedDelivery when the order has shipped.

  • needsAttention(order) should return true when the order is unpaid or has not shipped.

  • createOrderSummary(order) should return id, customerName, paid, shipped, itemCount, deliveryMessage, and needsAttention.

Sample checks:

js
const order = {  id: 'ORD-1001',  customer: {    name: 'Ava Stone',    email: 'ava@example.com',  },  payment: {    status: 'paid',  },  shipping: {    status: 'shipped',    estimatedDelivery: '2026-06-18',  },  items: [    { name: 'Notebook', quantity: 2 },    { name: 'Pen Set', quantity: 1 },  ],};console.log(createOrderSummary(order));console.log(isPaid(order));console.log(hasShipped(order));const pendingOrder = {  ...order,  payment: { status: 'unpaid' },  shipping: { status: 'processing', estimatedDelivery: '2026-06-18' },};console.log(needsAttention(pendingOrder));console.log(getDeliveryMessage(pendingOrder));

Expected output:

txt
{ id: "ORD-1001", customerName: "Ava Stone", paid: true, shipped: true, itemCount: 3, deliveryMessage: "Order shipped. Estimated delivery: 2026-06-18.", needsAttention: false }truetruetrueOrder has not shipped yet.

For itemCount, add item quantities instead of counting item rows.

Join the Community

roadmap.sh is the most starred project on GitHub and is visited by hundreds of thousands of developers every month.

Rank  out of 28M!

361K

GitHub Stars

Star us on GitHub
Help us reach #1

+90k every month

+2.1M

Registered Users

Register yourself
Commit to your growth

+2k every month

49K

Discord Members

Join on Discord
Join the community

Roadmaps Best Practices Guides Videos FAQs YouTube

roadmap.sh by @kamrify

Community created roadmaps, best practices, projects, articles, resources and journeys to help you choose your path and grow in your career.

ThewNewStack

The top DevOps resource for Kubernetes, cloud-native computing, and large-scale development and deployment.