From 46e8651b311ff868937fbe93937befdabddd2033 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Sirois Date: Thu, 25 Feb 2021 04:24:10 -0500 Subject: [PATCH] style: auto-format --- .../javascript/cannot-read-property.md | 66 +++++++++---------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/src/content/resources/language/javascript/cannot-read-property.md b/src/content/resources/language/javascript/cannot-read-property.md index dddd1d3..1e975ed 100644 --- a/src/content/resources/language/javascript/cannot-read-property.md +++ b/src/content/resources/language/javascript/cannot-read-property.md @@ -84,22 +84,22 @@ read property" error might arise. ```html - -

Welcome to The programmer's hangout.

-

- This is the place for programmers of any skill level to, well, hangout - with other fellow programmers. Whether you have just written 5 lines of - code or been a code nerd for 15 years, you are always welcome! -

- - + +

Welcome to The programmer's hangout.

+

+ This is the place for programmers of any skill level to, well, hangout + with other fellow programmers. Whether you have just written 5 lines of + code or been a code nerd for 15 years, you are always welcome! +

+ + ``` @@ -184,11 +184,11 @@ sure that situation is handled properly. ```js async function getUserID(username) { - // Assuming "username" is guaranteed to be a string. - let user = await botClient.fetchUser(username); - if (user == null) throw "There is no user with that name."; - // It is guaranteed now that "user" isn't null. - return user.id; + // Assuming "username" is guaranteed to be a string. + let user = await botClient.fetchUser(username); + if (user == null) throw "There is no user with that name."; + // It is guaranteed now that "user" isn't null. + return user.id; } ``` @@ -200,10 +200,8 @@ ultimately receive a value, the error won't be able to occur. ```js let payload; let rolledValue = Math.random(); -if (rolledValue > 0.5) - payload = { id: 169323, message: "Welcome to TPH." }; -else - payload = { id: 173205, message: "TPH has been waiting for you." }; +if (rolledValue > 0.5) payload = { id: 169323, message: "Welcome to TPH." }; +else payload = { id: 173205, message: "TPH has been waiting for you." }; // In either case, "payload" is guaranteed to be assigned an actual value. botClient.sendMessage(serverJoiner, payload.message); ``` @@ -215,17 +213,17 @@ provide default values for function arguments, if applicable. ```js function sendEmbed(content, options = { color: "#888", dismissable: false }) { - let embed = botClient.createEmbed(); - embed.setContent(content); - embed.setColor(options.color); - embed.setDismissable(options.dismissable); - botClient.sendEmbed(embed); + let embed = botClient.createEmbed(); + embed.setContent(content); + embed.setColor(options.color); + embed.setDismissable(options.dismissable); + botClient.sendEmbed(embed); } -sendEmbed( - "The programmer's hangout: https://theprogrammershangout.com", - { color: "#763989", dismissable: true } -); +sendEmbed("The programmer's hangout: https://theprogrammershangout.com", { + color: "#763989", + dismissable: true, +}); sendEmbed("Example site: https://example.com"); // No value is passed to "options" by the caller,