![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
疑难杂症
Amber8080
前端程序媛~~
展开
-
JS使用||运算符设置默认值
JS设置默认值在js中为参数设置默认值,最常用的两个方法,第一个是三元运算符,第二个就是||运算符。var a = args[0] ? args[0] : 1; //设置a的默认值为1var a = args[0] || 1; //设置a的默认值为1||运算符设置默认值的逻辑运算使用||运算符设置默认值的方式,是平时使用的比较多的。但前几天,在项目中发现了一个bug,代码是这种形式的:var a = args[0] || 1 + args[1] || 1 + args[3] || 1;这段原创 2021-04-13 19:45:01 · 1426 阅读 · 0 评论 -
CSS使用background简写遇到的坑
前言在使用backgound简写设置背景时,遇到了一个小坑,记录一下,提醒自己,要细心哪。background简写支持的属性background-color —背景颜色background-position —背景位置background-size —背景大小尺寸background-repeat —如何重复background-origin —制定背景定位的相对位置background-clip —背景区域background-attachment —背景固定或滚动backgroun原创 2021-04-11 16:45:38 · 634 阅读 · 0 评论 -
Mac安装nvm报错curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
前言:nvm是一个node版本管理器,对于前端这种缺乏统一规范的环境来说是十分必要的,遇到插件与node版本不兼容的情况时,往往需要切换node版本。安装 curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash 报错输入命令行后,报错curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection原创 2021-01-30 22:08:09 · 1375 阅读 · 2 评论