(1)、在html元素事件属性中使用,如:
(2)、构造函数
function Animal(name, color) { this.name = name; this.color = color;}
(3)、input点击,获取值
(4)、apply()/call()求数组最值
var numbers = [5, 458 , 120 , -215 ]; var maxInNumbers = Math.max.apply(this, numbers); console.log(maxInNumbers); // 458var maxInNumbers = Math.max.call(this,5, 458 , 120 , -215); console.log(maxInNumbers); // 458
.