-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ea8e4e
commit 349c8e0
Showing
8 changed files
with
49 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/node | ||
console.log('C is fun'); | ||
console.log('Python is cool'); | ||
console.log('Javascript is amazing'); | ||
console.log("C is fun"); | ||
console.log("Python is cool"); | ||
console.log("Javascript is amazing"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
#!/usr/bin/node | ||
const args = process.argv.slice(2); | ||
function factorial(n) { | ||
if (isNaN(n)) { | ||
return 1; | ||
} | ||
n = parseInt(n, 10); | ||
function factorial (n) { | ||
if (isNaN(n)) { | ||
return 1; | ||
} | ||
n = parseInt(n, 10); | ||
|
||
if (n === 0 || n === 1) { | ||
return 1; | ||
} else { | ||
return n * factorial(n - 1); | ||
} | ||
if (n === 0 || n === 1) { | ||
return 1; | ||
} else { | ||
return n * factorial(n - 1); | ||
} | ||
} | ||
const input = args[0]; | ||
const result = factorial(input); | ||
if (!isNaN(result) && isFinite(result)) { | ||
console.log(result); | ||
console.log(result); | ||
} else { | ||
console.log("Infinity"); | ||
} | ||
console.log('Infinity'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#!/usr/bin/node | ||
|
||
function callMeMoby(x, theFunction) { | ||
for (let i = 0; i < x ; i++) { | ||
function callMeMoby (x, theFunction) { | ||
for (let i = 0; i < x; i++) { | ||
theFunction(); | ||
} | ||
} | ||
} | ||
module.exports.callMeMoby = callMeMoby; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/node | ||
|
||
function addMeMaybe(number, theFunction) { | ||
theFunction(number+1); | ||
function addMeMaybe (number, theFunction) { | ||
theFunction(number + 1); | ||
} | ||
module.exports.addMeMaybe = addMeMaybe; | ||
module.exports.addMeMaybe = addMeMaybe; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
#!/usr/bin/node | ||
const myObject = { | ||
type: 'object', | ||
value: 12 | ||
}; | ||
console.log(myObject); | ||
myObject.incr = function () { | ||
myObject.value += 1; | ||
} | ||
myObject.incr(); | ||
console.log(myObject); | ||
myObject.incr(); | ||
console.log(myObject); | ||
myObject.incr(); | ||
console.log(myObject); | ||
type: 'object', | ||
value: 12 | ||
}; | ||
console.log(myObject); | ||
myObject.incr = function () { | ||
myObject.value += 1; | ||
}; | ||
myObject.incr(); | ||
console.log(myObject); | ||
myObject.incr(); | ||
console.log(myObject); | ||
myObject.incr(); | ||
console.log(myObject); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#!/usr/bin/node | ||
|
||
const args = process.argv.slice(2); | ||
if (args.length === 0) { | ||
const args = process.argv; | ||
if (!args[2]) { | ||
console.log('No Argument'); | ||
} else { | ||
console.log(args[0]); | ||
console.log(args[2]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/node | ||
|
||
const array = ['C is fun', 'Python is cool', 'JavaScript is amazing']; | ||
for (i = 0; i < array.length; i++) { console.log(array[i]); } | ||
for (let i = 0; i < array.length; i++) { console.log(array[i]); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters