Skip to content

Commit 6225a30

Browse files
author
Gael Estrera
committed
Node JS
1 parent 2dacb99 commit 6225a30

File tree

7 files changed

+41
-0
lines changed

7 files changed

+41
-0
lines changed

.DS_Store

4 KB
Binary file not shown.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ Web/SalesApp/Inventory/migrations/__pycache__/
66
*.DS_Store
77
DjangoSQL/django/
88
__pycache__/
9+
.DS_Store

Javascript/.DS_Store

2 KB
Binary file not shown.

Node/App.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const names = require('./names'); //to signifiy you will be using ur own modules within ur own directory
2+
const f1 = require('./utils');
3+
4+
5+
array = []
6+
let PKeys = Object.keys(names);
7+
for (let i=0; i < PKeys.length; i++){
8+
f1(names[PKeys[i]], 'BS MIS', 20, array);
9+
}
10+
console.log(array);
11+
12+

Node/models.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Person{
2+
constructor(Name, Course, Age){
3+
this.Name = Name;
4+
this.Course = Course;
5+
this.Age = Age;
6+
}
7+
8+
intro(){
9+
return `Hi, my name is ${this.Name}! I'm currently in ${this.Course}, and I'm ${this.Age} years old!`;
10+
}
11+
}
12+
13+
module.exports = {Person}

Node/names.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const p1 = 'Gael'
2+
const p2 = 'Jasam'
3+
const p3 = 'Sean'
4+
5+
6+
module.exports = { p1,p2,p3 }
7+
//console.log(module)

Node/utils.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const PersonClass = require('./models');
2+
3+
function CreateObject(Name, Course, Age, array){
4+
const person = new PersonClass.Person(Name,Course,Age);
5+
array.push(person);
6+
}
7+
8+
module.exports = CreateObject

0 commit comments

Comments
 (0)