Skip to content

Commit 17bfaa4

Browse files
committed
fixing editorconfig and changing tabs to 4-space
1 parent 3e062d6 commit 17bfaa4

File tree

3 files changed

+41
-29
lines changed

3 files changed

+41
-29
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = tab
8+
indent_size = 4
9+
10+
[*.md]
11+
indent_style = space
12+
indent_size = 4

getting-started/ch1.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,17 @@ Consider what the outcome of this program should be:
119119
var x = true;
120120

121121
if (x) {
122-
function gotcha() {
123-
console.log("One!");
124-
}
122+
function gotcha() {
123+
console.log("One!");
124+
}
125125
}
126126
else {
127-
function gotcha() {
128-
console.log("Two!");
129-
}
127+
function gotcha() {
128+
console.log("Two!");
129+
}
130130
}
131131

132-
gotcha(); // ??
132+
gotcha(); // ??
133133
```
134134

135135
While this may seem straightforward logically (print "One!"), the reality is much uglier. There are **many** different variations of this scenario, and each variation has slightly different semantics.
@@ -196,12 +196,12 @@ For example, a developer may write a snippet of code like:
196196

197197
```js
198198
if (something) {
199-
let x = 3;
200-
console.log(x);
199+
let x = 3;
200+
console.log(x);
201201
}
202202
else {
203-
let x = 4;
204-
console.log(x);
203+
let x = 4;
204+
console.log(x);
205205
}
206206
```
207207

@@ -211,12 +211,12 @@ This is how the code would look in the source code tree for that application. Bu
211211
var x$0;
212212
var x$1;
213213
if (something) {
214-
x$1 = 3;
215-
console.log(x$1);
214+
x$1 = 3;
215+
console.log(x$1);
216216
}
217217
else {
218-
x$2 = 4;
219-
console.log(x$2);
218+
x$2 = 4;
219+
console.log(x$2);
220220
}
221221
```
222222

@@ -254,9 +254,9 @@ A basic polyfill for `finally(..)` in pre-ES2019 environments could look like th
254254

255255
```js
256256
if (!Promise.prototype.finally) {
257-
Promise.prototype.finally = function f(fn){
258-
return this.then(fn,fn);
259-
};
257+
Promise.prototype.finally = function f(fn){
258+
return this.then(fn,fn);
259+
};
260260
}
261261
```
262262

getting-started/ch2.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Other than strings, JS programs often contain other primitive literal values suc
7272

7373
```js
7474
while (false) {
75-
console.log(3.141592);
75+
console.log(3.141592);
7676
}
7777
```
7878

@@ -107,7 +107,7 @@ Many developers prefer to treat them both consistently in this fashion, which is
107107

108108
```js
109109
while (value != undefined) {
110-
console.log("Still got something!");
110+
console.log("Still got something!");
111111
}
112112
```
113113

@@ -148,9 +148,9 @@ Consider:
148148
var adult = true;
149149

150150
if (adult) {
151-
var name = "Kyle";
152-
let age = 39;
153-
console.log("Shhh, this is a secret!");
151+
var name = "Kyle";
152+
let age = 39;
153+
console.log("Shhh, this is a secret!");
154154
}
155155

156156
console.log(name);
@@ -179,8 +179,8 @@ const myBirthday = true;
179179
let age = 39;
180180

181181
if (myBirthday) {
182-
age = age + 1; // OK!
183-
myBirthday = false; // Error!
182+
age = age + 1; // OK!
183+
myBirthday = false; // Error!
184184
}
185185
```
186186

@@ -193,7 +193,7 @@ const actors = [ "Morgan Freeman", "Jennifer Anniston" ];
193193

194194
actors[2] = "Tom Cruise"; // OK :(
195195

196-
actors = []; // Error!
196+
actors = []; // Error!
197197
```
198198

199199
The best semantic use of a `const` is when you have a simple primitive value that you want to give a useful name to, such as using `myBirthday` instead of `true`. This makes programs easier to read.
@@ -206,7 +206,7 @@ Besides `var` / `let` / `const`, there are other syntactic forms that declare id
206206

207207
```js
208208
function hello(name) {
209-
console.log(`Hello, ${name}.`);
209+
console.log(`Hello, ${name}.`);
210210
}
211211

212212
hello("Kyle");
@@ -221,10 +221,10 @@ Another syntax that declares a variable is the `catch` clause of a `try..catch`
221221

222222
```js
223223
try {
224-
someError();
224+
someError();
225225
}
226226
catch (err) {
227-
console.log(err);
227+
console.log(err);
228228
}
229229
```
230230

0 commit comments

Comments
 (0)