自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 变量提升 、隐式全局变量和局部变量

f1(); 调用函数function f1(){ //自定义函数var a=b=c=9;console.log(a); //a=9console.log(b); //b=9console.log(c); //c=9 }console.log(a); //报错console.log(b); //b=9console.log(c); //c=9解析 此时调用 f1()函数 则变量提升function f1(){ //自定义...

2021-11-08 23:45:00 144

原创 预解析 、变量提升

<script> f1(); //f1 is no defind; var f1=function(){ //自定义函数 console.log(a); // 不能够输出 var a=10;}// 解析 因为 var f1 会变量提升 var f1; f1(); //f1 is no defind; 此时f1就不能调用...

2021-11-07 15:54:38 88

原创 伪元素:hover

使用伪元素移入移出变颜色<style> .box{ width: 500px; height: 500px; margin: auto auto; font-size: 12em; color: paleturquoise; background-color: pink; text-align: center; line-height: 500px;

2021-10-31 23:37:13 220

原创 鼠标事件移入移出

JS代码//获取div盒子let div=document.querySelector(".box"); // 移入变蓝色 div.onmouseover=function fnc(){ div.style.background="blue" } // 移出变红色 div.onmouseout=function fn(){ div.style.background="red" } HTML代码.box{

2021-10-31 23:28:09 62

原创 箭头函数的使用

注意 使用箭头函数 this、指向windows call bind apply 这三种改变this指向不能改变arguments 方法就不能使用var func = () => {/// 箭头函数里面没有 this 对象,// 此时的 this 是外层的 this 对象,即 Windowconsole.log(this)}func(55) // Windowvar func = () => {console.log(arguments)...

2021-10-24 22:31:18 41

原创 for for each for in map循环 四种循环的语法

for(初始值;判断条件;变化语句){循环体}数组(对象).forEach(item,index,arr)---值,下标,当前循环数组for(键名 in 对象){执行语句(循环体);}while(判断语句){循环体};arr.map(function(){item,index,arr})//item 打印每一项 index下标 arr 数组var arr=[1,2,3,4];for (var i=0; i<arr.length; i++) { console.log(arr);

2021-10-17 22:51:30 125

原创 用函数求两个数之间的和

var num = 0; function func(x, y) { for (var i = x; i <= y; i++){ num += i; } console.log(num); } func(0, 99);

2021-10-12 22:21:40 571

原创 jsfor循环获取每个li的下标

for(var i=0;i<list.length;i++){ //循环所有的li list[i].index=i; //赋值 得到每个li的下标 list[i].onclick=function () { //点击事件 console.log(this.index); //点击之后打印当前li } }...

2021-10-07 23:28:20 1110

原创 css transparent属性_css 透明颜色transparent的使用

在css中 transparent到底是什么意思呢? transparent 它代表着全透明黑色,即一个类似rgba(0,0,0,0)这样的值。例如在css属性中定义:background:transparent,意思就代表背景透明。实际上background默认的颜色就是透明的属性,所以写和不写都是一样的。实例:使用若想得到编号①方向向下三角形,只需对编号②③④三角形让其透明transparent;border-top设置需要显示颜色即可 transparent 值来画一个三角形只需要

2021-10-01 23:25:22 17925 1

原创 新手易接受的数组去重

iddexof 方法var arr = [2, 8, 5, 0, 5, 2, 6, 7, 2]//定义一个空的数组var newArr = []//根据for循环来循环arr里面的数据 然后作比较for (var i = 0; i < arr.length; i++) {//如果等于-1 则没有重复的if (newArr.indexOf(arr[i]) === -1) {//添加数据newArr.push(arr[i])}}consol...

2021-09-26 20:21:15 60

原创 怎么使用js打印菱型

document.write('<center/>') var a=3; for(var i=1;i<=a;i++){ for(var b=1;b<=2*i-1;b++){ document.write("*") } document.write('<br/>') } for(var i=a-1;i>=1;i--){ for(var b=2..

2021-09-21 23:31:16 61

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除