---
title: "js 函数定义 functioan 关键字 与 ()=>{} es6语法"
author: "征客丶"
date: "2017-07-28T17:24:12Z"
tags: []
categories: ["Web前端"]
slug: "js-functioan-es6"
draft: false
lastmod: "2017-07-28T17:24:12Z"
id: 2387571
url: "https://binary-space.iteye.com/blog/2387571"
---

用es6语法定义函数 如:
f_es6_t = ()=>{
}
其在函数内使用 this 指针时，是安全稳定的，不会因调用对象而转变；

用 function关键字定义函数，如：
f_function_t = function(){
}
在函数内部的 this 指针会随调用对象而改变，所以有使用函数内部的 this 指针有时并不是你所期望的 this，可使用 bind 方法，绑定 this 指针对象，从而得到稳定安全的 this 指针。
例： f_function_t.bind(object)