Skip to content

Commit

Permalink
all
Browse files Browse the repository at this point in the history
  • Loading branch information
oumatoulacen committed Sep 13, 2023
1 parent d672158 commit 4f43e34
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 9 deletions.
2 changes: 0 additions & 2 deletions 0x13-javascript_objects_scopes_closures/10-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ console.log(myConverter(2));
console.log(myConverter(12));
console.log(myConverter(89));


myConverter = converter(16);

console.log(myConverter(2));
console.log(myConverter(12));
console.log(myConverter(89));

31 changes: 31 additions & 0 deletions 0x13-javascript_objects_scopes_closures/102-concat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/node

const fs = require('fs');

if (process.argv.length !== 5) {
console.error('Usage: node 102-concat.js <file1> <file2> <destination>');
process.exit(1);
}

const [, , file1Path, file2Path, destinationPath] = process.argv;

fs.readFile(file1Path, 'utf8', (err1, data1) => {
if (err1) {
process.exit(1);
}

fs.readFile(file2Path, 'utf8', (err2, data2) => {
if (err2) {
process.exit(1);
}

const concatenatedData = data1 + data2;

fs.writeFile(destinationPath, concatenatedData, 'utf8', (err3) => {
if (err3) {
console.error(`Error writing to ${destinationPath}: ${err3}`);
process.exit(1);
}
});
});
});
3 changes: 1 addition & 2 deletions 0x13-javascript_objects_scopes_closures/7-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ const nbOccurences = require('./7-occurrences').nbOccurences;

console.log(nbOccurences([1, 2, 3, 4, 5, 6], 3));
console.log(nbOccurences([3, 2, 3, 4, 5, 3, 3], 3));
console.log(nbOccurences(["S", 12, "c", "S", "School", 8], "S"));

console.log(nbOccurences(['S', 12, 'c', 'S', 'School', 8], 'S'));
3 changes: 1 addition & 2 deletions 0x13-javascript_objects_scopes_closures/8-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
const esrever = require('./8-esrever').esrever;

console.log(esrever([1, 2, 3, 4, 5]));
console.log(esrever(["School", 89, { id: 12 }, "String"]));

console.log(esrever(['School', 89, { id: 12 }, 'String']));
6 changes: 3 additions & 3 deletions 0x13-javascript_objects_scopes_closures/9-main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/node
const logMe = require('./9-logme').logMe;

logMe("Hello");
logMe("Best");
logMe("School");
logMe('Hello');
logMe('Best');
logMe('School');
1 change: 1 addition & 0 deletions 0x13-javascript_objects_scopes_closures/fileA
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C is fun!
1 change: 1 addition & 0 deletions 0x13-javascript_objects_scopes_closures/fileB
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Python is Cool!!!
2 changes: 2 additions & 0 deletions 0x13-javascript_objects_scopes_closures/fileC
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
C is fun!
Python is Cool!!!

0 comments on commit 4f43e34

Please sign in to comment.