Converted all tabs to spaces.

This commit is contained in:
Lê Duy Quang
2021-02-25 04:21:57 -05:00
committed by Jean-Philippe Sirois
parent 0862031bf9
commit b854b46050
@@ -56,9 +56,9 @@ This applies to nonexistent array indices as well.
```js ```js
> let keyMapping = { > let keyMapping = {
moveUp: "KeyW", moveUp: "KeyW",
moveDown: "KeyS", moveDown: "KeyS",
moveLeft: "KeyA", moveLeft: "KeyA",
moveRight: "KeyD" moveRight: "KeyD"
}; };
undefined undefined
> keyMapping.mvoeDown > keyMapping.mvoeDown
@@ -84,22 +84,22 @@ read property" error might arise.
```html ```html
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<body> <body>
<p id=paragraph-1>Welcome to <i>The programmer's hangout</i>.</p> <p id=paragraph-1>Welcome to <i>The programmer's hangout</i>.</p>
<p id=paragraph-2> <p id=paragraph-2>
This is the place for programmers of any skill level to, well, 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 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! code or been a code nerd for 15 years, you are always welcome!
</p> </p>
<script> <script>
let element = document.getElementById("paragraph-3"); let element = document.getElementById("paragraph-3");
// The one writing this might think this will add another paragraph to // The one writing this might think this will add another paragraph to
// the page, which is not how it works. // the page, which is not how it works.
// The browser, failing to find any element with ID "paragraph-3" from // The browser, failing to find any element with ID "paragraph-3" from
// the page, returns null. // the page, returns null.
element.innerText = "When joining, make sure you read the rules."; element.innerText = "When joining, make sure you read the rules.";
</script> </script>
</body> </body>
</html> </html>
``` ```
@@ -143,21 +143,21 @@ one can make sure what is in their hands isn't JavaScript's default
```js ```js
async function onCommand(channel, arguments) { async function onCommand(channel, arguments) {
// Assuming the command is not empty and // Assuming the command is not empty and
// there is always the first argument. // there is always the first argument.
let commandName = arguments[0]; let commandName = arguments[0];
switch (commandName) { switch (commandName) {
// ... // ...
case "getUser": case "getUser":
if (arguments.length < 2) if (arguments.length < 2)
throw "Usage: /getUser <username>"; throw "Usage: /getUser <username>";
// It is guaranteed now that "arguments" has at least 2 elements // It is guaranteed now that "arguments" has at least 2 elements
// and thus there is an index 1. // and thus there is an index 1.
let username = arguments[1]; let username = arguments[1];
let user = await botClient.fetchUser(username); let user = await botClient.fetchUser(username);
channel.send(JSON.stringify(user); channel.send(JSON.stringify(user);
break; break;
// ... // ...
} }
} }
``` ```
@@ -170,8 +170,8 @@ sure that situation is handled properly.
async function getUserID(username) { async function getUserID(username) {
// Assuming "username" is guaranteed to be a string. // Assuming "username" is guaranteed to be a string.
let user = await botClient.fetchUser(username); let user = await botClient.fetchUser(username);
if (user == null) throw "There is no user with that name."; if (user == null) throw "There is no user with that name.";
// It is guaranteed now that "user" isn't null. // It is guaranteed now that "user" isn't null.
return user.id; return user.id;
} }
``` ```