Skip to content

Commit b8ed985

Browse files
committed
learnyounode exercises completed
1 parent e308ef6 commit b8ed985

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

Diff for: babySteps.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function sum(array){
2+
var total = 0;
3+
for (var i=2; i<array.length; i++){
4+
total += Number(array[i]);
5+
}
6+
return total;
7+
}
8+
console.log(sum(process.argv));

Diff for: helloWorld.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("HELLO WORLD");

Diff for: myFirstI_O.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var fs = require('fs');
2+
var fileName = process.argv[2];
3+
var fileContents = fs.readFileSync(fileName);
4+
var fileText = fileContents.toString();
5+
var numLines = (fileText.split('\n').length)-1;
6+
console.log(numLines);

0 commit comments

Comments
 (0)