From 4a5dea63a4dbc6d578a3cefb1161b29401192c2e Mon Sep 17 00:00:00 2001 From: Chopper Date: Sun, 22 Oct 2023 19:39:01 +0700 Subject: [PATCH] add: README.md, index.html, index.js, test.js --- 2. Run NodeJS File/README.md | 8 ++++++++ 2. Run NodeJS File/index.html | 11 +++++++++++ 2. Run NodeJS File/index.js | 32 ++++++++++++++++++++++++++++++++ 2. Run NodeJS File/test.js | 7 +++++++ 4 files changed, 58 insertions(+) create mode 100644 2. Run NodeJS File/README.md create mode 100644 2. Run NodeJS File/index.html create mode 100644 2. Run NodeJS File/test.js 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;