posted @ 2021-02-01 10:13 猫头唔食鱼 阅读(357) 评论(0) 推荐(0)
摘要:
$("select").change(function(){ console.log($(this).val()); }); 阅读全文
摘要:
function HTMLDecode(text) { var temp = document.createElement("div"); temp.innerHTML = text; var output = temp.innerText || temp.textContent; temp = n 阅读全文
posted @ 2021-02-01 10:05 猫头唔食鱼 阅读(285) 评论(0) 推荐(0)
摘要:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document< 阅读全文
posted @ 2021-02-01 09:47 猫头唔食鱼 阅读(181) 评论(0) 推荐(0)
摘要:
let isSuportLocalstorage = ()=> window.localStorage ? true :false console.log(isSuportLocalstorage()); 阅读全文
posted @ 2021-01-31 18:28 猫头唔食鱼 阅读(630) 评论(0) 推荐(0)
摘要:
例如,有一个对象,有3个属性,只想把其中两个属性,转化成JSON字符串 let obj = {name:'zs',age:12,addr:'gz'} // 原始对象 let arr = ['name','age'] // 需要转化成JSON字符串的属性数组 JSON.stringify(obj,ar 阅读全文
posted @ 2021-01-31 18:15 猫头唔食鱼 阅读(216) 评论(0) 推荐(0)
摘要:
let isComplete = ()=> document.readyState 'complete' ? true : false if(isComplete()){ // 页面加载完成 } 阅读全文
posted @ 2021-01-27 17:37 猫头唔食鱼 阅读(408) 评论(0) 推荐(0)
摘要:
数值分割符 说明:数字太长,看得眼花,就用数值分隔符分割 let a = 100_000 // 1000000 逗号运算符 逗号运算符只返回最后一个结果的值 let a = 1+2,3,5 // 5 阅读全文
posted @ 2021-01-21 10:18 猫头唔食鱼 阅读(129) 评论(0) 推荐(0)
摘要:
// 非简写 let x = 'a' if (x 'a' || x 'b' || x 'c' || x 'd') { console.log(11111); } // 简写 let arr = ['a', 'b', 'c', 'd'] if (arr.includes(x)) { console.l 阅读全文
posted @ 2021-01-21 10:13 猫头唔食鱼 阅读(1603) 评论(0) 推荐(0)
摘要:
1.错误情况 (1)空数组直接用fill,得到的是空数组 // 空数组直接用fill,是填充不了任何内容的 let a = [] a.fill(undefined) console.log(a); // [] (2)使用new Array,得到的是empty // new Array生成的是empt 阅读全文
posted @ 2021-01-21 10:11 猫头唔食鱼 阅读(225) 评论(0) 推荐(0)