矢印機能は既存の機能の動作を再定義できますか? jQueryのgetを使用する(はい、私が知っている) - 私は矢印関数が使用されるかどうかに応じて、この成功の2つの異なる値を得ています。それはなぜ起こるのか誰も説明できますか?矢印機能はこのコンテキストを変更します
var get = (e) => {
return new window.Promise((resolve, reject) => {
$.ajax({
context: {test: 1}, // this
type: "GET",
url: "...",
complete: function() {
// this is only correct when using old syntax, arrow
// function would redefine the value of this to the function's parent
},
complete:()=>{ } // Is not working, this is not what I'd expect.
});
});
矢印機能についての約5分の研究では、どの矢印機能が/何であるかをかなり簡単に説明できます。 –