9.12

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

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