From 637f0cf7f23f8f1f789f5f78fc06b8b5901aa710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Mon, 6 Jul 2020 18:30:34 -0400 Subject: [PATCH] docs: update README example and REPL link --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 472558348f0a..31b74893567a 100644 --- a/README.md +++ b/README.md @@ -63,19 +63,21 @@ Babel is a tool that helps you write code in the latest version of JavaScript. W **In** ```js -// ES2015 arrow function -[1, 2, 3].map((n) => n + 1); +// ES2020 nullish coalescing +function greet(input) { + return input ?? "Hello world"; +} ``` **Out** ```js -[1, 2, 3].map(function(n) { - return n + 1; -}); +function greet(input) { + return input != null ? input : "Hello world"; +} ``` -Try it out at our [REPL](https://babeljs.io/repl/build/main#?code_lz=NoRgNATGDMC6B0BbAhgBwBQDsAEBeAfNjgNTYgCUA3EA&lineWrap=true&presets=es2015%2Ces2016%2Ces2017&version=7.0.0-beta.2). +Try it out at our [REPL](https://babel.dev/repl#?browsers=defaults%2C%20not%20ie%2011&loose=true&code_lz=GYVwdgxgLglg9mABAcwE4FN1QBQzABxCgEpEBvAKEUQyhFST0KkQH5XEAiACXQBs-cRAHc4qPgBNOAbgoBfIA&shippedProposals=true&sourceType=script&lineWrap=true&presets=env%2Cenv&prettier=true). ## FAQ