摘要:
1.通用模式 var getSingle = function( fn ){ var result; return function(){ return result || ( result = fn .apply(this, arguments ) ) } }; 阅读全文
摘要:
qq中有10000个好友,每秒中渲染20个好友: var timeChunk = function(arr, fn, count) { var t; var start = function() { for(var i = 0; i < Math.min(count || 1, arr.length 阅读全文
摘要:
节流: 1. var throttle = function(fn,delay){ var pre = Date.now(); return function(){ var __me = this; var args = arguments; var now = Date.now(); if(now 阅读全文
摘要:
1. const obj1 ={ name:'a' } const obj2 = { name: 'a' } const arr = [1,2,3]; const arr2 = [1,2,3] console.log(obj1 == obj2, arr == arr2)//false,false 2 阅读全文
摘要:
1. var c = 1; function a () { var c =1; c = c+2; console.log('fn : '+c) }; a();//3 console.log( c) //1 阅读全文
摘要:
1.var c = 1; function c(c){ console.log(c) } c(2) // c is not a function 2. var c = 1; function c (){} console.log(typeof c) //'number' 3. if(!b in wi 阅读全文
摘要:
1.导出 //导出name1,name2,name3,name的key值 redis-cli -h 127.0.0.1 -a 123 -p 6300 --scan --pattern "name*" >> testredis.json 阅读全文
摘要:
const OSS = require('ali-oss') let client = new OSS({ region: 'oss-cn-najing', accessKeyId: 'youid', accessKeySecret: 'yoursecret', bucket: 'yourbucke 阅读全文
摘要:
app.all('*', function (req, res, next) { res.set('Access-Control-Allow-Origin', '*'); res.set('Access-Control-Allow-Credentials', true); res.set('Acce 阅读全文
摘要:
const fs = require("fs"); const mineType = require("mime-types"); function imgToBase64(url) { try { let imgurl = config.imageUrl; let imageData = fs.r 阅读全文