Skip to content

Commit dfb513a

Browse files
committed
Improve examples
1 parent 95bf8b5 commit dfb513a

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

JavaScript/6-logger.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const logger = (level = 'info') => {
3+
const logger = (level) => {
44
const color = logger.colors[level] || logger.colors.info;
55
return s => {
66
const date = new Date().toISOString();

JavaScript/7-prototype.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
function Logger(level = 'info') {
3+
function Logger(level) {
44
this.color = Logger.colors[level] || Logger.colors.info;
55
}
66

JavaScript/8-class.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
class Logger {
4-
constructor(level = 'info') {
4+
constructor(level) {
55
this.color = Logger.colors[level] || Logger.colors.info;
66
}
77

JavaScript/d-get-set.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Rect {
2424
}
2525

2626
const p1 = new Rect(10, 20, 50, 100);
27-
console.log(p1.side);
2827
console.log(p1.area);
2928
p1.side = 150;
29+
console.log(p1.side);
3030
console.log(p1.area);

JavaScript/e-array.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ class Person {
2323
const difference = new Date() - new Date(this.birth);
2424
return Math.floor(difference / 31536000000);
2525
}
26+
toString() {
27+
return this.name + ' age is ' + this.age;
28+
}
2629
}
2730

2831
const query = (person) => (
@@ -39,4 +42,4 @@ data.forEach(person => {
3942
});
4043

4144
const res = data.filter(query);
42-
console.dir(res);
45+
console.dir(res + '');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy