diff --git "a/\351\231\210\345\234\243\346\201\251/\345\212\240\345\207\217\344\271\230\351\231\244/\345\205\250\345\261\200\345\217\230\351\207\217.js" "b/\351\231\210\345\234\243\346\201\251/\345\212\240\345\207\217\344\271\230\351\231\244/\345\205\250\345\261\200\345\217\230\351\207\217.js" new file mode 100644 index 0000000000000000000000000000000000000000..41be5442d935c35df6cf9bf56c30eaed752cdba3 --- /dev/null +++ "b/\351\231\210\345\234\243\346\201\251/\345\212\240\345\207\217\344\271\230\351\231\244/\345\205\250\345\261\200\345\217\230\351\207\217.js" @@ -0,0 +1,25 @@ +console.log("这算什么"); +// 获取这个文件得路径 __filename 是绝对路径 包括这个文件的文件名 +console.log(__filename); + +// 获取这个文件所在得文件夹 +console.log(__dirname); + +setTimeout(() => { + console.log("我是每隔二秒执行的"); +}, 2000); + +// setInterval(() => { +// console.log("我是每隔一秒执行的"); +// }, 1000); + +// console.log(process); 进程 + +// 使用进程 +process.on('exit',function(){ + console.log("我是结束时候执行的"); +}) + +process.on('beforeExit',function(){ + console.log("我是结束前执行的"); +}) \ No newline at end of file diff --git "a/\351\231\210\345\234\243\346\201\251/\345\212\240\345\207\217\344\271\230\351\231\244/\345\212\240\345\207\217obj.js" "b/\351\231\210\345\234\243\346\201\251/\345\212\240\345\207\217\344\271\230\351\231\244/\345\212\240\345\207\217obj.js" new file mode 100644 index 0000000000000000000000000000000000000000..ce1c9f243745a4989e26517d4b84905c8ef3e136 --- /dev/null +++ "b/\351\231\210\345\234\243\346\201\251/\345\212\240\345\207\217\344\271\230\351\231\244/\345\212\240\345\207\217obj.js" @@ -0,0 +1,20 @@ +var obj = { + 'jia':function (a,b) { + console.log(a+b); + }, + 'jian':function(a,b){ + console.log(a - b); + }, + 'cheng':function(a,b){ + console.log(a * b); + }, + 'chu':function(a,b){ + console.log(a / b); + } +} +module.exports= obj; + +function flower(){ + console.log("送依托答辩"); +} +module.exports.flower = flower; \ No newline at end of file diff --git "a/\351\231\210\345\234\243\346\201\251/\345\212\240\345\207\217\344\271\230\351\231\244/\346\250\241\346\235\277.js" "b/\351\231\210\345\234\243\346\201\251/\345\212\240\345\207\217\344\271\230\351\231\244/\346\250\241\346\235\277.js" new file mode 100644 index 0000000000000000000000000000000000000000..6da6af7a134fc049e498222cad96699269ace746 --- /dev/null +++ "b/\351\231\210\345\234\243\346\201\251/\345\212\240\345\207\217\344\271\230\351\231\244/\346\250\241\346\235\277.js" @@ -0,0 +1,10 @@ +// 引入加减模版 +var obj = require('./加减obj.js'); +// console.log(obj); + +obj.jia(20,15); +obj.jian(20,15); +obj.cheng(20,15); +obj.chu(20,15); + +obj.flower(); \ No newline at end of file diff --git "a/\351\231\210\345\234\243\346\201\251/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232node.js" "b/\351\231\210\345\234\243\346\201\251/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232node.js" new file mode 100644 index 0000000000000000000000000000000000000000..fba80acb867f0894fd00e01e46c57415654f4ebf --- /dev/null +++ "b/\351\231\210\345\234\243\346\201\251/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232node.js" @@ -0,0 +1 @@ +console.log("第一次node作业"); diff --git "a/\351\231\210\345\234\243\346\201\251/\351\232\217\346\234\272\347\224\237\346\210\220\346\226\207\344\273\266/.vscode/settings.json" "b/\351\231\210\345\234\243\346\201\251/\351\232\217\346\234\272\347\224\237\346\210\220\346\226\207\344\273\266/.vscode/settings.json" new file mode 100644 index 0000000000000000000000000000000000000000..3986f4a75962f445df8863c929fcde5046b77569 --- /dev/null +++ "b/\351\231\210\345\234\243\346\201\251/\351\232\217\346\234\272\347\224\237\346\210\220\346\226\207\344\273\266/.vscode/settings.json" @@ -0,0 +1,4 @@ +{ + "editor.suggest.snippetsPreventQuickSuggestions": false, + "aiXcoder.showTrayIcon": true +} \ No newline at end of file diff --git "a/\351\231\210\345\234\243\346\201\251/\351\232\217\346\234\272\347\224\237\346\210\220\346\226\207\344\273\266/demo01.js" "b/\351\231\210\345\234\243\346\201\251/\351\232\217\346\234\272\347\224\237\346\210\220\346\226\207\344\273\266/demo01.js" new file mode 100644 index 0000000000000000000000000000000000000000..562c59b949601da2a708e1661f1ccd7e02e33b96 --- /dev/null +++ "b/\351\231\210\345\234\243\346\201\251/\351\232\217\346\234\272\347\224\237\346\210\220\346\226\207\344\273\266/demo01.js" @@ -0,0 +1,25 @@ +'use strict' // 严格模式 +var fs = require('fs'); +var arr = []; +for (var i = 1; i <= 2; i++) { + var sj = Math.floor(Math.random() * (1000 - 1 + 1) + 1); + var text = "" + sj + ""; + var file = "./" + i + ".txt" + fs.writeFileSync(file, text); + arr.push(Number(text)); +} +var max = arr[0]; +var maxfile = ''; +for (var j = 1; j <= arr.length; j++) { + if(max < arr[j]){ + max = arr[j]; + maxfile = file; + } +} +console.log(maxfile); + + + + + + diff --git "a/\351\231\210\345\234\243\346\201\251/\351\232\217\346\234\272\347\224\237\346\210\220\346\226\207\344\273\266/demo02.js" "b/\351\231\210\345\234\243\346\201\251/\351\232\217\346\234\272\347\224\237\346\210\220\346\226\207\344\273\266/demo02.js" new file mode 100644 index 0000000000000000000000000000000000000000..868f825a419f41cb70a65463b119af86e134f065 --- /dev/null +++ "b/\351\231\210\345\234\243\346\201\251/\351\232\217\346\234\272\347\224\237\346\210\220\346\226\207\344\273\266/demo02.js" @@ -0,0 +1,16 @@ +'use strict' // 严格模式 +var fs = require('fs'); +var Maxfile = ''; //最大的文件名 +var Max = 0; +for (var i = 1; i <= 5; i++) { + // Math.floor(Math.random() * (max - min + 1) + min + var sj = Math.floor(Math.random() * (1000 - 1 + 1) + 1); + var text = "" + sj + ""; + var file = "./" + i + ".txt" + fs.writeFileSync(file, text); // 同步 + if(Number(text) > Max){ // 文本里面的内容和 0 比较 比0大 max就替换成文本内容 + Max = Number(text); + Maxfile = file; + } +} +console.log(Maxfile);