Javascript学习笔记

1.获取时间戳

new Date().getTime() 获取单位毫秒的时间戳

parseInt(new Date().getTime().toString().slice(0,10)) 获取单位秒的时间戳

2.将函数参数(类数组对象)转为数组

[].slice.call(arguments) 或者 Array.prototype.slice.apply(arguments)

3.判断变量是否已经定义

typeof foo === 'undefined'

4.全局变量及函数是不可配置的,不可配置的属性不可被 delete 操作符删除。

var x = 1; // 相当于window.x
delete x; // false
原文地址:https://www.cnblogs.com/hisheng/p/6014849.html