diff --git a/2. Run NodeJS File/README.md b/2. Run NodeJS File/README.md new file mode 100644 index 0000000..a867393 --- /dev/null +++ b/2. Run NodeJS File/README.md @@ -0,0 +1,8 @@ +## Open your Gitbash and run your js file + +go to file directory +example cd ./2. Run NodeJS File + +```bash + node yourname.js +``` diff --git a/2. Run NodeJS File/index.html b/2. Run NodeJS File/index.html new file mode 100644 index 0000000..3974e7d --- /dev/null +++ b/2. Run NodeJS File/index.html @@ -0,0 +1,11 @@ + + + + + + Document + + + + + diff --git a/2. Run NodeJS File/index.js b/2. Run NodeJS File/index.js index e69de29..6baf92c 100644 --- a/2. Run NodeJS File/index.js +++ b/2. Run NodeJS File/index.js @@ -0,0 +1,32 @@ +// 1 +// console.log("Hello world"); +// const myName = "Drian"; + +// 2 +// const printName = (name) => `Hi, my name is ${name}`; + +// console.log(printName(myName)); + +// 3 +// can't use it on node +// console.log(window); +// console.log(window.alert("log")); + +// 4 +// alse can't use it on node +// function printName(name) { +// return `Hi, my name is ${name}`; +// } + +// console.log(window.printName(myName)); + +// 5 +// require("./test"); + +// console.log("Hello world"); + +// 6 +// Module system +const printName = require("./test"); + +console.log(printName("Drian from index js")); diff --git a/2. Run NodeJS File/test.js b/2. Run NodeJS File/test.js new file mode 100644 index 0000000..e818b7a --- /dev/null +++ b/2. Run NodeJS File/test.js @@ -0,0 +1,7 @@ +console.log("Hello Drian"); + +const printName = (name) => `Hi, my name is ${name}`; + +console.log(printName("Drian from test js")); + +module.exports = printName;