From 5d57a04b66d7674215ca2acef82fd80e020a54c3 Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Sun, 14 Aug 2022 11:25:47 +0300 Subject: [PATCH] closes #3111 --- 1-js/02-first-steps/15-function-basics/article.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/1-js/02-first-steps/15-function-basics/article.md b/1-js/02-first-steps/15-function-basics/article.md index 79dee432..5160fc53 100644 --- a/1-js/02-first-steps/15-function-basics/article.md +++ b/1-js/02-first-steps/15-function-basics/article.md @@ -206,7 +206,13 @@ function showMessage(from, *!*text = "no text given"*/!*) { showMessage("Ann"); // Ann: no text given ``` -Now if the `text` parameter is not passed, it will get the value `"no text given"` +Now if the `text` parameter is not passed, it will get the value `"no text given"`. + +The default value also jumps in if the parameter exists, but strictly equals `undefined`, like this: + +```js +showMessage("Ann", undefined); // Ann: no text given +``` Here `"no text given"` is a string, but it can be a more complex expression, which is only evaluated and assigned if the parameter is missing. So, this is also possible: