第十课:内置对象;

170 阅读1分钟

内置对象是指根据标准在全局作用域(Global)上存在的对象;

  1. ECMAScript存在的内置对象:BooleanErrorDateRegExp 等。
const a: Boolean = true;
const b: Error = new Error('err');
const c: Date = new Date();
const d: RegExp = /'a'/;
  1. DOM和BOM内置对象:DocumentHTMLElementEventNodeListMouseEvent等。
const a: HTMLElement = document.body;
const b: NodeList = document.querySelectorAll('div')
document.addEventListener('click', function(e: MouseEvent) {
  // Do something
});