Skip to content

Commit

Permalink
get started: fixing style for template-literal expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
getify committed Dec 10, 2019
1 parent c43eb0f commit b2f8761
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
28 changes: 14 additions & 14 deletions get-started/ch2.md
Expand Up @@ -271,7 +271,7 @@ Besides `var` / `let` / `const`, there are other syntactic forms that declare id

```js
function hello(name) {
console.log(`Hello, ${name}.`);
console.log(`Hello, ${ name }.`);
}

hello("Kyle");
Expand Down Expand Up @@ -595,9 +595,9 @@ class Publication {

print() {
console.log(`
Title: ${this.title}
By: ${this.author}
${this.pubDate}
Title: ${ this.title }
By: ${ this.author }
${ this.pubDate }
`);
}
}
Expand All @@ -622,8 +622,8 @@ class Book extends Publication {
print() {
super.print();
console.log(`
Published By: ${this.publisher}
ISBN: ${this.ISBN}
Published By: ${ this.publisher }
ISBN: ${ this.ISBN }
`);
}
}
Expand Down Expand Up @@ -702,9 +702,9 @@ function Publication(title,author,pubDate) {
var publicAPI = {
print() {
console.log(`
Title: ${title}
By: ${author}
${pubDate}
Title: ${ title }
By: ${ author }
${ pubDate }
`);
}
};
Expand All @@ -723,8 +723,8 @@ function Book(bookDetails) {
print() {
pub.print();
console.log(`
Published By: ${bookDetails.publisher}
ISBN: ${bookDetails.ISBN}
Published By: ${ bookDetails.publisher }
ISBN: ${ bookDetails.ISBN }
`);
}
};
Expand Down Expand Up @@ -807,9 +807,9 @@ Consider the file `publication.js`:
```js
function printDetails(title,author,pubDate) {
console.log(`
Title: ${title}
By: ${author}
${pubDate}
Title: ${ title }
By: ${ author }
${ pubDate }
`);
}

Expand Down
18 changes: 9 additions & 9 deletions get-started/ch3.md
Expand Up @@ -34,7 +34,7 @@ Consider:
```js
function greeting(msg) {
return function who(name) {
console.log(`${msg}, ${name}!`);
console.log(`${ msg }, ${ name }!`);
};
}

Expand Down Expand Up @@ -84,7 +84,7 @@ Closure is most common when working with asynchronous code, such as with callbac
```js
function getSomeData(url) {
ajax(url,function onResponse(resp){
console.log(`Response (from ${url}): ${resp}`);
console.log(`Response (from ${ url }): ${ resp }`);
});
}

Expand All @@ -99,7 +99,7 @@ It's not necessary that the outer scope be a function -- it usually is, but not
```js
for (let [idx,btn] of buttons.entries()) {
btn.addEventListener("click",function onClick(evt){
console.log(`Clicked on button (${idx})!`);
console.log(`Clicked on button (${ idx })!`);
});
}
```
Expand Down Expand Up @@ -132,7 +132,7 @@ Consider:
function classroom(teacher) {
return function study() {
console.log(
`${teacher} wants you to study ${this.topic}`
`${ teacher } wants you to study ${ this.topic }`
);
};
}
Expand Down Expand Up @@ -271,7 +271,7 @@ Consider:
```js
var homework = {
study() {
console.log(`Please study ${this.topic}`);
console.log(`Please study ${ this.topic }`);
}
};

Expand Down Expand Up @@ -324,7 +324,7 @@ var it = /* .. */;

// loop over its results one at a time
for (let val of it) {
console.log(`Iterator value: ${val}`);
console.log(`Iterator value: ${ val }`);
}
// Iterator value: ..
// Iterator value: ..
Expand Down Expand Up @@ -376,7 +376,7 @@ Consider:
var arr = [ 10, 20, 30 ];

for (let val of arr) {
console.log(`Array value: ${val}`);
console.log(`Array value: ${ val }`);
}
// Array value: 10
// Array value: 20
Expand Down Expand Up @@ -413,7 +413,7 @@ buttonNames.set(btn2,"Button 2");

for (let [btn,btnName] of buttonNames) {
btn.addEventListener("click",function onClick(){
console.log(`Clicked ${btnName}`);
console.log(`Clicked ${ btnName }`);
});
}
```
Expand All @@ -436,7 +436,7 @@ Or if we want the index *and* value in an array iteration, we can make an entrie
var arr = [ 10, 20, 30 ];

for (let [idx,val] of arr.entries()) {
console.log(`[${idx}]: ${val}`);
console.log(`[${ idx }]: ${ val }`);
}
// [0]: 10
// [1]: 20
Expand Down

0 comments on commit b2f8761

Please sign in to comment.