首页 > 其他 > 详细

9.12

时间:2020-09-12 16:16:02      阅读:35      评论:0      收藏:0      [点我收藏+]

1. js 的六种基本数据类型?

 ES5 中的基本数据类型有 5 种:Undefined、Null、Boolean、Number、String.而 Object 是属于复杂数据类型,所以我认为这里说的 6 种基本数据类型是指:Undefined、Null、Boolean、Number、String 与 Symbol.

2.

arr.shift()删除数组第一个元素

arr.push()从数组的最后面加元素

arrr.unshift() 冲数组的最前面加元素

arr.concat() 复制原来数组生成新数组然后在后面加上()里面的元素

3.以下哪些选项可以获取ID为a的DOM元素?

document.getElementById(‘A‘)

document.querySelector(‘#a‘)返回文档中匹配指定 CSS 选择器的一个元素。
所以要获取ID为a的DOM元素,需要加上#+id名。也就是document.querySelector("#a");

4.页面有一个按钮button id为 button1,通过原生的js如何禁用?(IE 考虑IE 8.0以上版本)

document.getElementById("button1").disabled = true;

document.getElementById("button1").setAttribute(“disabled”,”true”);

5.下面哪些属于JavaScript的typeof运算符的可能结果:()

typeof Symbol()    //"symbol"
typeof Number()    //"number"
typeof String()    //"string"
typeof Function()    //"function"
typeof Object()    //"object"
typeof Boolean()    //"boolean"
typeof null    //"object"
typeof undefined    //"undefined"
 
 

typeof Symbol() //" symbol"

typeofNumber()//‘number’

typeofString()//‘string’

typeofFunction()//‘function’

typeof Object()//object

typeof null //object

typeof bollean() //boolean

typeof undefinded //undefinded

 

9.12

原文:https://www.cnblogs.com/smhyu/p/13656603.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!