博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
前端面试题
阅读量:7025 次
发布时间:2019-06-28

本文共 1578 字,大约阅读时间需要 5 分钟。

###年后开启前端面试刷街模式,积累的一些js基础,欢迎添加更新,或是指正错误

1. 特殊字符比较

console.log(null==NaN)                          falseconsole.log(null==undefined)                    trueconsole.log(null==false)                        trueconsole.log(false=="")                          trueconsole.log(false==0)                           trueconsole.log(2+1+'3')                            '33'console.log('3'+2+1)                            '321'console.log(Number(undefined))                  NaNconsole.log(Number(''))                         0console.log(isNaN(23))                          trueconsole.log(typeof NaN)                         Numberconsole.log(isNaN(NaN))                         trueconsole.log(NaN==NaN)                           falseconsole.log(undefined===undefined)              true复制代码

2.变量提升

function t(a){    var a ='hello';    console.log(a);    function a(){        console.log(null);    }    console.log(a);}t(null);               ***************** hello   hellofunction a(b){    console.log(b);    b=function(){        alert(b);    }}a();                   ****************  undefinedfunction fn(b){    console.log(b);    function b(){        console.log(b);    }    b();                 }fn(1)                  *************** function b(){...}  function b(){...}复制代码

3.数组去重,取最大值

随机打印1-100 的10个数字,去重后取出数组中的最大值和最小值

function randomArray(){    var resul=[];    while(resul.length<10){        resul.push(Math.floor(Math.random()*100));        resul= [...new Set(resul)];    }    return resul;}var maxvalue =Math.max(...randomArray())var minvalue =Math.min(...randomArray())复制代码

转载地址:http://ljmxl.baihongyu.com/

你可能感兴趣的文章
我的友情链接
查看>>
我们是如何上网?
查看>>
JavaWEB程序员电脑必备配置
查看>>
我的友情链接
查看>>
oracle性能调优总结
查看>>
relink all the executables of 11g
查看>>
冲突域和冲突域
查看>>
Sass学习笔记 -- 嵌套
查看>>
linux日志分析及管理
查看>>
netapp学习(二)---开启DNS功能
查看>>
创建MYSQL用户及授权用户权限
查看>>
TextView颜色等属性在string.xml定义
查看>>
docker迁移容器
查看>>
HBase 表数据 导入导出
查看>>
PropertyGrid无意的发现DisplayNameAttribute及应用
查看>>
我的友情链接
查看>>
Android之计算缓存大小并且清空缓存
查看>>
tomcat报内存溢出,解决方案
查看>>
DI序曲二十五 App-V与Remote App综合使用
查看>>
LVS+Keepalived相关参考资料
查看>>