文章目录
  1. 1. escape unescape
  2. 2. understanding-primitive-and-getter-setters

js 的神奇

escape unescape

understanding-primitive-and-getter-setters

1
2
console.log(a==1&&a==2&a==3);//true
console.log(a===1&&a===2&a===3);//true
1
2
3
4
5
6
const a = { value : 0 };
a.valueOf = function() {
return this.value += 1;
};

console.log(a==1 && a==2 && a==3); //true
1
2
3
4
5
6
7
8
var value = 0; //window.value
Object.defineProperty(window, 'a', {
get: function() {
return this.value += 1;
}
});

console.log(a===1 && a===2 && a===3) /true

http://theanubhav.com/2018/11/07/understanding-primitive-and-getter-setters/

https://ivweb.io/article.html?_id=100337

文章目录
  1. 1. escape unescape
  2. 2. understanding-primitive-and-getter-setters
Fork me on GitHub