<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/goodbye-if-else-hello-pattern-matching-in-javascript-proposal--foyris1iu" -->

---
title: Goodbye if-else, Hello Pattern Matching in JavaScript...
description: JavaScript is evolving with the proposal of pattern matching, which aims to replace if-else statements with a more declarative syntax. Pattern matching allows...
canonical: https://daily.dev/posts/goodbye-if-else-hello-pattern-matching-in-javascript-proposal--foyris1iu
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Goodbye if-else, Hello Pattern Matching in JavaScript (PROPOSAL) | daily.dev
og:description: JavaScript is evolving with the proposal of pattern matching, which aims to replace if-else statements with a more declarative syntax. Pattern matching allows...
og:url: https://daily.dev/posts/goodbye-if-else-hello-pattern-matching-in-javascript-proposal--foyris1iu
og:image: https://api.daily.dev/og/posts/fOyRiS1iu.png
og:image:alt: Goodbye if-else, Hello Pattern Matching in JavaScript (PROPOSAL)
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Goodbye if-else, Hello Pattern Matching in JavaScript (PROPOSAL)

**[Medium](https://daily.dev/sources/medium_js)** · 4 min read · 2 upvotes · 0 comments

## Summary

JavaScript is evolving with the proposal of pattern matching, which aims to replace if-else statements with a more declarative syntax. Pattern matching allows for matching against the shape and contents of a value in a single expression, providing a more concise alternative to chained if-else statements and switch cases. It can match literals, variables, objects, and types, and offers advantages such as a more declarative syntax, the ability to match full objects, and the automatic handling of default cases. Pattern matching is currently a Stage 1 ECMAScript proposal and can be compiled to supported JavaScript using Babel.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://medium.com/@techsuneel99/goodbye-if-else-hello-pattern-matching-in-javascript-proposal-e8682458d863?source=rss------javascript-5>

---

Tags: [#javascript](https://daily.dev/tags/javascript), [#data-science](https://daily.dev/tags/data-science), [#nodejs](https://daily.dev/tags/nodejs), [#babel](https://daily.dev/tags/babel)

[View this post on daily.dev](https://daily.dev/posts/goodbye-if-else-hello-pattern-matching-in-javascript-proposal--foyris1iu)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Goodbye if-else, Hello Pattern Matching in JavaScript (PROPOSAL)","url":"https://daily.dev/posts/goodbye-if-else-hello-pattern-matching-in-javascript-proposal--foyris1iu","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/goodbye-if-else-hello-pattern-matching-in-javascript-proposal--foyris1iu"},"datePublished":"2023-10-13T16:58:14.360Z","dateModified":"2023-10-12T08:57:52.866Z","description":"JavaScript is evolving with the proposal of pattern matching, which aims to replace if-else statements with a more declarative syntax. Pattern matching allows...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ae1069731807c38ac713ea07bb1fd341?_a=AQAEufR","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ae1069731807c38ac713ea07bb1fd341?_a=AQAEufR","isAccessibleForFree":true,"articleSection":"Medium","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Medium","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/medium","url":"https://daily.dev/sources/medium_js"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/goodbye-if-else-hello-pattern-matching-in-javascript-proposal--foyris1iu","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"javascript,data-science,nodejs,babel","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Medium","item":"https://daily.dev/sources/medium_js"},{"@type":"ListItem","position":3,"name":"Goodbye if-else, Hello Pattern Matching in JavaScript (PROPOSAL)"}]}
```

