Skip to content

Commit 6e4de4a

Browse files
committed
Rename class to avoid name conflicts
1 parent ad5ff96 commit 6e4de4a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

JavaScript/2-class.js

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

3-
class Date {
3+
class DateStruct {
44
constructor(year, month, day) {
55
this.day = day;
66
this.month = month;
@@ -18,7 +18,7 @@ class Person {
1818

1919
// Usage
2020

21-
const p1 = new Person('Marcus', 'Roma', new Date(121, 4, 26));
21+
const p1 = new Person('Marcus', 'Roma', new DateStruct(121, 4, 26));
2222

2323
const date = `${p1.born.year}-${p1.born.month}-${p1.born.day}`;
2424
console.log(`Name: ${p1.name}\nCity: ${p1.city}\nBorn: ${date}\n`);

JavaScript/3-file.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const v8 = require('v8');
44
const fs = require('fs');
55

6-
class Date {
6+
class DateStruct {
77
constructor(year, month, day) {
88
this.day = day;
99
this.month = month;
@@ -21,7 +21,7 @@ class Person {
2121

2222
// Usage
2323

24-
const p1 = new Person('Marcus', 'Roma', new Date(121, 4, 26));
24+
const p1 = new Person('Marcus', 'Roma', new DateStruct(121, 4, 26));
2525

2626
const v8Data = v8.serialize(p1);
2727
const v8File = './3-file.dat';

0 commit comments

Comments
 (0)