2021年2月3日

摘要: let a = 10000000 let b = 1e7 // 7个0就是7 这是数字1,不是字母l console.log(a==b) // true 阅读全文

posted @ 2021-02-03 17:39 猫头唔食鱼 阅读(334) 评论(0) 推荐(0) 编辑

摘要: // 禁止右键 window.oncontextmenu = function () { return false } // 禁止f12 document.onkeydown=function (e){ var currKey=0,evt=e||window.event; currKey=evt.k 阅读全文

posted @ 2021-02-03 17:04 猫头唔食鱼 阅读(108) 评论(0) 推荐(0) 编辑

摘要: let require = ()=>{throw new Error('函数必须传参')} let print = (num=require())=>{console.log(num)} print(2) // 2 print(null) // null print() // 报错 阅读全文

posted @ 2021-02-03 17:03 猫头唔食鱼 阅读(82) 评论(0) 推荐(0) 编辑

摘要: { // 通过length获取前面几项 let arr = [1,2,3,4] arr.length = 2 console.log(arr); // [1,2] } { // 通过splice获取前面几项 let arr = [1,2,3,4] console.log(arr.splice(0,2 阅读全文

posted @ 2021-02-03 15:22 猫头唔食鱼 阅读(2022) 评论(0) 推荐(0) 编辑

摘要: // 格式化输出的JSON字符串 console.log(JSON.stringify({ alpha: 'A', beta: 'B' }, null, '\t')); 控制台打印的: 阅读全文

posted @ 2021-02-03 15:15 猫头唔食鱼 阅读(137) 评论(0) 推荐(0) 编辑

摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="wi 阅读全文

posted @ 2021-02-03 15:13 猫头唔食鱼 阅读(257) 评论(0) 推荐(0) 编辑