String
@H_404_3@padEnd 和 @H_404_3@padStart
-
@H_404_3@'abc'.padEnd(10); // "abc " 'abc'.padEnd(10,"foo"); // "abcfoofoof" 'abc'.padEnd(6,"123456"); // "abc123" 'abc'.padEnd(1); // "abc"
-
@H_404_3@'abc'.padStart(10); // " abc" 'abc'.padStart(10,"foo"); // "foofoofabc" 'abc'.padStart(6,"123465"); // "123abc" 'abc'.padStart(8,"0"); // "00000abc" 'abc'.padStart(1); // "abc"
-
@H_404_3@'abc'.repeat(-1); // RangeError 'abc'.repeat(0); // '' 'abc'.repeat(1); // 'abc' 'abc'.repeat(2); // 'abcabc' 'abc'.repeat(3.5); // 'abcabcabc' (count will be converted to integer) 'abc'.repeat(1/0); // RangeError
@H_404_3@>>> 和 @H_404_3@>>
-
@H_404_3@>>> 无符号位移,如果是负数,会将符号位右移,变成非负数
@H_404_3@-9 >>> 2 // 1073741821 -9 >> 2 // -3
- @H_404_3@>> 有符号位移
-
@H_404_3@num >> 0 可以将不能转化为数字的字符转化为0
@H_404_3@NaN >> 0 // 0
Object
@H_404_3@Object.defineProperty() 和 Object.defineProperties()
-
@H_404_3@Object.defineProperty() 定义对象属性细节,有两个descriptors: data descriptors(value 和writable) 和 accessor descriptors(set 和 get),其中两者不能共存
@H_404_3@Object.defineProperty(obj,'a',{ writable: true,enumerable: true,configurable: true value: 0x9f91102,get() { return 0xdeadbeef; } }) // threw error
Object.defineProperties(obj,{
a;{
writable: true,configurable: true
},b;{
writable: true,configurable: true
}
}) -
@H_404_3@Object.creat() 创建新对象,将已知对象作为新对象的原型
@H_404_3@Object.creat({a: 1111},{ a: { writable: true,configurable: true } })
-
@H_404_3@Object.is() 比较两个值
@H_404_3@Object.is(NaN,NaN); // true Object.is(+0,-0); // false
+0 === -0; // true
NaN === NaN; // false