Skip to content

Commit afc2376

Browse files
committed
hello node
1 parent d7dbf63 commit afc2376

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+6613
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const http = require('http');
2+
3+
const server = http.createServer((req, res) => {
4+
res.end('Hello World\n');
5+
});
6+
7+
server.listen(4242, () => {
8+
console.log('Server is running...');
9+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('Pluralsight rocks');
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
setTimeout(
2+
() => {
3+
console.log('Hello after 4 seconds');
4+
},
5+
4 * 1000
6+
);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const func = () => {
2+
console.log('Hello after 4 seconds');
3+
};
4+
5+
setTimeout(func, 4 * 1000);
6+
7+
8+
// For: func(arg1, arg2, arg3, ...)
9+
// We can use: setTimeout(func, delay, arg1, arg2, arg3, ...)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const rocks = who => {
2+
console.log(who + ' rocks');
3+
};
4+
5+
setTimeout(rocks, 2 * 1000, 'Pluralsight');
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const theOneFunc = () => {};
2+
3+
setTimeout(theOneFunc, 4 * 1000);
4+
5+
// Hello after 4 seconds
6+
7+
// Hello after 8 seconds
8+
9+
// You can define only ONE function
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const theOneFunc = delay => {
2+
console.log('Hello after ' + delay + ' seconds');
3+
};
4+
5+
setTimeout(theOneFunc, 4 * 1000, 4);
6+
7+
setTimeout(theOneFunc, 8 * 1000, 8);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
setInterval(
2+
() => console.log('Hello every 3 seconds'),
3+
3000
4+
);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const timerId = setTimeout(
2+
() => console.log('You will not see this one!'),
3+
0
4+
);
5+
6+
clearTimeout(timerId);

0 commit comments

Comments
 (0)